Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FBN: jar file to submit - Need help

 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
As the different packages in the FBN assignment uses "import suncertify.mypackage", how are we suppose to organize the jar files to submit ?
I mean, if my package suncertify.server, import the suncertify.db, and the package suncertify.client also import the db package, how do I create client.jar and server.jar ?
Do I have to include suncertify.db in both jar files ?
Thanks for your help.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raphael A B,
Please change your display name to comply with The JavaRanch Naming Policy.
Thank You
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had,
fbnServer.jar - Server only files
fbnClient.jar - Client only files
fbnCommon.jar - Used by client and server
fbnServerForClient.jar - _Stub classes and remote interfaces.
 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well Sai Prasad
I am trying to that but I get the following error about the "imported" packages : ClassNoDefFounError : ...
when I try to run the jar file using java -jar myjar_file.jar (where an entry point has been defined)
Can you help ?
Thanks
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the jar file doesn't contain one of the referenced classes.
 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No It does not,
And my question is : Do I have to add all the imported packages in each of these jar or is a way around it ?
Regards,
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Imported packages must be present in the CLASSPATH. There is no way around it.
 
Matthew Comer
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Three ways to fix your problem:
1) Add the extra jars to the classpath on the command line
2) Put the extra jars on your classpath using the environment variable
3) *RECOMMENDED* Put an entry in the manifest file of the main jars that references the extra jars
Matt
 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Matthew Comer and Sai Prasad ,
I have tried the following on command line :
Set CLASSPATH=My_extra_jar_file.jar
java -jar my_server.jar or
java -classpath My_extra_jar_file.jar -jar my_server.jar
but none of these worked. Still get ClassNoDefFoundError.
How do you add the referrence to the extra jar in the manifest ?
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic