Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble running packaged jar application

 
Wansin Ounkeo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 3 packages for my FBN classes:
suncertify.db
suncertify.server
suncertify.ui
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.
 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic