• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Trouble running packaged jar application

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic