File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes problem running client.jar executable 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 "problem running client.jar executable" Watch "problem running client.jar executable" New topic
Author

problem running client.jar executable

Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Hi,
I created two executable jar files in root directory of my assignment: client.jar, server.jar. I include stub classed in client.jar.
I got the following exceptions trying to connect
to the server:

I could run my application without using executable jars. I am wondering what's wrong
with it.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

I could run my application without using executable jars.

I had the same problem. This is likely because you forgot to include the subs and/or remote interfaces in your client jar. When you ran your client as a class, it could find the stubs from the classpath, but when you run it from the jar, there is no classpath.
The other thing to make evrything easier is to start rmi from within your application, so that you don't need to set codebase, policy, or security manager.
My client start is as simple as
java -jar client.jar
Eugene.
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
This is likely because you forgot to include the subs and/or remote interfaces in your client jar. When you ran your client as a class, it could find the stubs from the classpath, but when you run it from the jar, there is no classpath.

I included stubs from server package, and interfaces from db package. About the classpath and executable jars, can you elaborate more on this? This may be the problem I have.

The other thing to make evrything easier is to start rmi from within your application, so that you don't need to set codebase, policy, or security manager.
My client start is as simple as
java -jar client.jar

You mean start rmi using LocateRegistry without using codebase, policy and security manager? I
have a policy file in my root directory, a manifest file for either client or server, and I start rmi in command line before I start server.

I used the same command as you did. I could start my server like this:
java -jar server.jar
but my client crashes with the above exceptions,
even I run it from my assignment root directory
which contains jar files. Whats wrong? Any guidance?
[ July 02, 2002: Message edited by: Holmes Wong ]
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Gosh, I guess several threads are asking this same question. Any expert opinions?
Alex Gregory
Ranch Hand

Joined: Jun 15, 2002
Posts: 46
Holmes Wong, make sure that if you put your stubs and skels inside server.jar you add this to your manifest file when you jar the client jar file.
Class-path: server.jar
Hopefully this was your problem solver.
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Thanks, Alex. Thats a great tip, it solved my problem.
Originally posted by Alex Gregory:
Holmes Wong, make sure that if you put your stubs and skels inside server.jar you add this to your manifest file when you jar the client jar file.
Class-path: server.jar
Hopefully this was your problem solver.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem running client.jar executable