A Program Accessing Another Program
Hey,
I'm trying to find a way to do this. I have a java program that connects to the internet which connects to another computer with another java program. Is there a way that the java program on my computer can access the java program on the other computer, start it up, and pass a file to it?
[308 byte] By [
blackmagea] at [2007-11-27 9:00:54]

This reminds me RMI - Remote Method Invocation. You can invoke methods of an object located on another JVM.You ll probably need sth related to networkin apis
What you mean with> a way that the java program on my computer can> access the java program on the other computer?You can run a command in the os with Runtime.getRuntime().exec("command");You can connect they with Sockets...
As our friend said, RMI is one way to do this. If you want to increase your buzzword-compliance, web services could be another avenue. Web services have the added advantage of allowing messaging between disparate systems in a variety of languages. If you want your buzzword-compliance to really soar, look into JBI as well :-)
Sorry
I ve never used RMI
What I know is that the client (who invokes the remote method) has to have or implement a remote interface that hides from it the fact that the methods represented are remote. This interface is often called "stub" and runs on the clients jvm
There might be a more specialied forum here
Cya
> What you mean with
>
> > a way that the java program on my computer can
> > access the java program on the other computer
>
> ?
>
> You can run a command in the os with
> Runtime.getRuntime().exec("command");
>
> You can connect they with Sockets
>
> .
> .
> .
Nope. RMI allows you to invoke methods on an object that resides in a separate JVM, possibly on another machine, too, (almost) as if they were local methods. RMI sits on top of the socket layer, so you don't really need to use the socket API to do it, although an understanding of how sockets work will help
> RMI is one way to do this. If you
> want to increase your buzzword-compliance, web
> services could be another avenue. Web services have
> the added advantage of allowing messaging between
> disparate systems in a variety of languages. If you
> want your buzzword-compliance to really soar, look
> into JBI as well :-)
I'm sure we haven't exhausted the buzzwords web services can deliver:
The Java API for XML Web Services (JAX-WS) is the centerpiece of a newly rearchitected API stack for Web services, the so-called "integrated stack" that includes JAX-WS 2.0, JAXB 2.0 (Java Architecture for XML Binding provides a convenient way to bind an XML schema to a representation in Java code. This makes it easy for you to incorporate XML data and processing functions in applications based on Java technology without having to know much about XML itself) and SAAJ 1.3 (The SOAP with Attachments API for Java provides a standard way to send XML documents over the Internet from the Java platform). The integrated stack represents a logical rearchitecture of Web services functionality in the Java WSDP. JAX-WS is designed to take the place of JAX-RPC in Web services and Web applications.You can use the Java API for XML-based RPC (JAX-RPC) to build Web applications and Web services, incorporating XML-based RPC functionality according to the SOAP 1.1 specification.
Ok I mean like, I want a program from one computer to be able to access the methods of a program on another computer.
> Ok I mean like, I want a program from one computer to> be able to access the methods of a program on another> computer.Oh. Well, that's easy. Just read some of the replies you've already received in this very thread
> Ok I mean like, I want a program from one computer to
> be able to access the methods of a program on another
> computer.
There are many different ways to approach your problem. And I don't think your problem is "a program from one computer being able to access the methods of a program on another computer". That's a possible *solution* to the problem. The problem is higher-level. To get better help here, I suggest you tell us what your problem really is. What is your goal?
Message was edited by:
BigDaddyLoveHandles
The goal is...
I'm making a program that stores data entered to it on a folder on the computer. But when a person wants to back the files up, they click a button that takes the files on the computer, zips it up, connects through to the internet and searches for the ip of another computer. Once it finds the IP, the program connects to the other computer and searches for the reciever java program. Once thats done, it then sends the zip file to the reciever program on the other computer and that program unzips and puts the folder in the correct location on the other computer.
> The goal is...
> I'm making a program that stores data entered to it
> on a folder on the computer. But when a person wants
> to back the files up, they click a button that takes
> the files on the computer, zips it up, connects
> through to the internet and searches for the ip of
> another computer. Once it finds the IP, the program
> connects to the other computer and searches for the
> reciever java program. Once thats done, it then sends
> the zip file to the reciever program on the other
> computer and that program unzips and puts the folder
> in the correct location on the other computer.
I'm confused. You asked how to access methods on another machine, and have been told a variety of ways in which to do this. What's the problem?
There is none now. BigDaddyLoveHandles just asked what was my goal so I just said the whole things incase there was something else.Btw, is there any example code?Message was edited by: blackmage
> There is none now. BigDaddyLoveHandles just asked> what was my goal so I just said the whole things> incase there was something else.Sweet. Go forth and invoke, then :-)
So on the server side, you want to be able to receive a file, hopefully a zip file,
which you process by unzipping and etc...?
I can imagine a web application that lets you do this, backed by a web service, so that you could so this task manually from a browser, or programmatically from a client application. Using a web service, rather than RMI, allows you a lot of flexibility in your client -- it doesn't have to be written in Java, for example.
> So on the server side, you want to be able to receive
> a file, hopefully a zip file,
> which you process by unzipping and etc...?
>
> I can imagine a web application that lets you do
> this, backed by a web service, so that you could so
> this task manually from a browser, or
> programmatically from a client application. Using a
> web service, rather than RMI, allows you a lot of
> flexibility in your client -- it doesn't have to be
> written in Java, for example.
Although building-in that sort of flexibility "just in case", without considering whether it's necessary, or likely to be used, is classic over-engineering
> Although building-in that sort of flexibility "just in case", without considering > whether it's necessary, or likely to be used, is classic over-engineeringOkay, lose the web app ;-)
>So on the server side, you want to be able to receive a file, hopefully a zip file,
>which you process by unzipping and etc...?
>I can imagine a web application that lets you do this, backed by a web service, >so that you could so this task manually from a browser, or programmatically >from a client application. Using a web service, rather than RMI, allows you a lot >of flexibility in your client -- it doesn't have to be written in Java, for example.
I'm iffy about allowing flexibity in the client. Bc in my mind, flexibilty=greater chances for virus, so I'm using a java program where everything is controlled. And the program isn't in a browser, its on a computer that many users r suppose to have.
> I'm iffy about allowing flexibity in the client. Bc in my mind, flexibilty=greater
> chances for virus, so I'm using a java program where everything is controlled.
How is writing the client in Java going to increase security?
> And the program isn't in a browser, its on a computer that many users r suppose to have.
I was just suggesting that providing a web application as an interface might me nice. It's not required.
> > I'm iffy about allowing flexibity in the client. Bc
> in my mind, flexibilty=greater
> > chances for virus, so I'm using a java program
> where everything is controlled.
>
> How is writing the client in Java going to increase
> security?
>
As compared to a handy dandy ActiveX control for example?
What exactly do u mean by client?
> What exactly do u mean by client?The client (application) is the application on the user's machine.