Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Newby RMI question  RSS feed

Tony Evans
Ranch Hand
Posts: 598
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a simple RMI program that works.
My question is this:
I have a inteface tasks residing in RMITest/Server.
In my client code I have the following line of code.
import RMITest.Server.tasks;
But in a real application, the client and server will reside on differant systems.
I think the code I use is java.rmi.server.RMIClassLoader to load a class from a remote server for use in the clients JVM.
Problem is I cant find any examples of using this, all the exmples are run in the same directory so this problem will never arise.
As I see it I would need to pass the server host, port and the classpath to the interface.
would the code be something like this:
Class aclass=java.rmi.server.RMIClassLoader.loadClass("localHost/classes/task");
task atask = (task)aclass.newInstance();
But will I still need the task interface on the client side as well as on the server .
Thanks for any info Tony
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!