Im looking into RMI for a university project, and ive run into a bit of a problem. From what ive read, java version 5 and up should generate the necessary stub files automatically (as i understand there was previously an additional step required).
However after following this tutorial here http://download.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html and compiling my classes with Javac, ive only got the standard class files, no sign of my stub files.
This is confirmed when i try and run my project, my application crashes saying that it cant find any stub files. Am i missing something?
NB, running java -version
gives me this:
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b17, mixed mode)
I believe you used something like
RemoteInterface stub =
(RemoteInterface) UnicastRemoteObject.exportObject(server);
in your server, instead of
RemoteInterface stub =
(RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
Note two arguments to exportObject()
-- second version returns different type. It indeed make difference for me.