I have just started using RMI and am having a problem as follows :-
I have created my classes in a package named rmitest. The server class is a simple class called HelloWorld and I have succesfully created and compiled the HelloWorldImpl class. The class HelloWorldImpl_Stub has been created and is in the same directory as HelloWorldImpl but when I try and start the main class that calls Naming.rebind(), i get a no class def found error.
I have a directory called d:\JavaProjects\rmitest the files in here are in a package called rmitest. The files created by rmic are also in this directory. I invoked
rmic -d d:\JavaProjects -classpath d:\JavaProjects rmitest.HelloWorldImpl
This creates the HelloWorldImpl_Stub class and the HelloWorldImpl_Skel.class an puts them in d:\JavaProjects\rmitest
Then I start the registry tool.
Now when I try to invoke the main class (I called it RMIServer) by using
java -classpath d:\JavaProjects rmitest.RMIServer
I get a NoClassDefFound error, complaining it can't find rmitest.HelloWorldImpl_Stub. When I change the name of the main class parameter(to rmitest.HelloWorldImpl_Stub) to the VM, it finds it OK but complains of no main method as I would expect. So that proves the class is there and in the right package.
Any ideas ?