The moose likes Developer Certification (SCJD/OCMJD) and the fly likes help with RMI & jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "help with RMI & jar" Watch "help with RMI & jar" New topic

help with RMI & jar

Alex Gregory
Ranch Hand

Joined: Jun 15, 2002
Posts: 46
guys, unfortunately I still cant get my jars and rmi to work together, after spending the whole night. I'm really stuck 100%.
I followed some people's suggestion to use LocateRegistry.createRegistry(), and everything works before I run my programs from jars.
And when I work with the jars I get: classNotFound exceptions of stubs.
to recap, my directory structure is :
and when I jarred i created server.jar which has *.class from db and server, and client.jar which has *.class from db and client.
I run the server.jar like this:
java -jar server.jar %1 %2
This works fine, but client.jar is what gives the exceptions:
java -jar client.jar %1 %2 %3
I'm really drowning here, please help me, I never knew that submitting this thing would be so hard, nothing is easy here, so please help, because all i have left to do is this packaging, otherwise im done.
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
You need to have the *.stub files in your client.jar. Also check that your classpath is correctly set. If you have to use the cobebase argument
Hope this helps
Alex Gregory
Ranch Hand

Joined: Jun 15, 2002
Posts: 46
The whole point of using LocateRegistry was to eliminate the need for codebase, and why set the classpath since we are using jars?
Also, right now I have the stubs and skels in both client and server jar? But in non jar way I only have stubs and skel in server and everything works. Please please help'
Alex Gregory
Ranch Hand

Joined: Jun 15, 2002
Posts: 46
After about 21 hours and a migraine, I found out my problem. When people kept saying to use classpath with manifest i didnt know how to do it. But here it is:
Class-path: server.jar
Thus, I only keep my stubs and skeletons in the server.jar, and add the following line to the client.jar manifest file. Thanks for the people who tried to help me, I know this will help others so they dont spend time like me.
I agree. Here's the link:
subject: help with RMI & jar
It's not a secret anymore!