wood burning stoves
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Trouble running packaged jar application 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 "Trouble running packaged jar application" Watch "Trouble running packaged jar application" New topic

Trouble running packaged jar application

Wansin Ounkeo

Joined: Mar 17, 2002
Posts: 2
I have 3 packages for my FBN classes:
The classes in one package import classes from another package and vice versa. When I compile and run these (unjarred), everything works fine.
I'm working on jarring everything now.
I have jarred just the classes and stubs and skeletons into db.jar, server.jar,
and ui.jar in the starting directory. So my c:\scjd\starting\ directory contains db.jar, server.jar, ui.jar and db.db.
My server's RmiFBNServerReg.class has a main() and my UI's FlyByNight.class has a main().
I would like to run the server as a separate process and ditto for the FlyByNight clients.
In my manifest file for my server.jar, I have
Main-Class: suncertify.server.RmiFBNSreverReg
In my manifest file for my ui.jar,I also have
Main-Class: suncertify.ui.FlyByNight

My problem is when I run the following from my scjd\starting\ directory:
java -jar server.jar
I get an error:
... java.lang.NoClassDefFoundError: suncertify/ui/DatabaseInterface ...

I'm assuming Java runtime is trying to find the suncertify.ui.DatabaseInterface class file that doesn't exist in the executing server.jar file.
3 questsion:
1) Can I allow java to find the missing classes without including those classes in the respective packages? I don't want to include them because they belong in separate packages.
2) If I jar my 3 jar files into another larger jar file, I won't be able to call the separate main()s in server.jar and ui.jar , correct?
3) Also one quick side question: How do I set the default directory for the JFileChooser?
Thanks in advance for anyone who can help me.

Me!*****,~!~.<br />Wansin*/ / \ \ <br />10/00**||O-O||<br />****___'\_^_/'___<br />***/ . o000o . \<br />**/==/_ __ _ __\==\<br />*|(___,-=,~`_ _ _ )|
Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
I think your server.jar requires the DBInterface class or interface to run. I think you are placing that in db.jar so try a
java -classpath $CLASSPATH:./db.jar:. -jar server.jar

Never be satisfied with anything less than the best and you will surely pass the test...
I agree. Here's the link: http://aspose.com/file-tools
subject: Trouble running packaged jar application
It's not a secret anymore!