wood burning stoves*
The moose likes Distributed Java and the fly likes My RMI client consists of a Java command-line app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "My RMI client consists of a Java command-line app" Watch "My RMI client consists of a Java command-line app" New topic
Author

My RMI client consists of a Java command-line app

Naidu Sanapala
Greenhorn

Joined: Nov 26, 2005
Posts: 8
Hello,

My RMI client consists of a Java command-line app that uses Naming.lookup to obtain a reference to the remote interface. As one needs to typecast the return object to the remote interface, the client code depends on the remote interface for successful compilation and execution.

Also, I have a data class that is used by both the RMI server components and RMI client components. This is the return type for the remote method invoked by the client.

What is the correct approach out of the options given below?

a) Include the remote interface and the data class in the build classpath. This is inevitable during development and is the only way to compile the client app and remote implementation code.

However, at the time of execution, you may just mention the codebase so that the remote interface and/or data class bytecode gets downloaded. This is applicable to both the client app and the remote implementation.

b) Include the remote interface and the data class in both the build and run classpath. This is inevitable and is the only way to compile and execute the client app and remote implementation.

I would greatly appreciate your answers to my query.

If there is any other approach apart from the ones that I have mentioned, please let me know.

Thanks,
Naidu Sanapala


Naidu Sanapala<br />J2EE Architect<br />Laurel, Maryland, USA.<br /> <br />................................................................................................<br />1.SUN Certified Enterprise Architect for J2EE Technology<br />2.Sun Certified [EJB] Business Component Developer for the J2EE Platform<br />3.Sun Certified Web Component Developer for the J2EE Platform<br />4.Sun Certified Java Programmer for the Java 2 Platform - 1.4<br />5.IBM Certified Solution Developer for XML and Related Technologies<br />................................................................................................
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Either of these approaches can be used, however, most are going to go with the (a) approach. Using dynamic RMI classloading makes your code more flexible to change, and if you need to make changes or fixes to some classes, you won't need to re-deploy code to all your clients - they get this code dynamically from the server, so they will always get the newest code.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: My RMI client consists of a Java command-line app