File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Imbedded jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Imbedded jar file" Watch "Imbedded jar file" New topic
Author

Imbedded jar file

Terrence White
Ranch Hand

Joined: Jun 26, 2002
Posts: 39
I have an application packaged as a jar file, and it uses two other jar files when it runs.
I get it to work with no problem when I add the "Class-Path" header into
the manifest file as follows:
Class-Path: firstFile.jar secondFile.jar
In this scenario, the jar files are located in the same directory as the
jar that I am envoking.
Is there a way for me to place these jars inside of the jar that I am envoking and get it to run?
When I put them inside of my executable jar, the files cannot be found, and I get infamous "java.lang.NoClassDefFoundError" error.
How can I get the classpath to reach into the executable jar?
Vinod Chandana
Ranch Hand

Joined: Aug 26, 2003
Posts: 59
Hi Terrence,
If the classpath is set to smthg like blahblah;.; then it will check the current directory also for the classes. Do let me know if ur classpath includes "."
Regards,
Vinod.
Originally posted by Terrence White:
I have an application packaged as a jar file, and it uses two other jar files when it runs.
I get it to work with no problem when I add the "Class-Path" header into
the manifest file as follows:
Class-Path: firstFile.jar secondFile.jar
In this scenario, the jar files are located in the same directory as the
jar that I am envoking.
Is there a way for me to place these jars inside of the jar that I am envoking and get it to run?
When I put them inside of my executable jar, the files cannot be found, and I get infamous "java.lang.NoClassDefFoundError" error.
How can I get the classpath to reach into the executable jar?
Terrence White
Ranch Hand

Joined: Jun 26, 2002
Posts: 39
I am trying to package all of the jar files that the program needs into one jar.
As it stands now (I do have the dot in the CLASSPATH), it is searching the current direcory, but I need it to look into the executable jar file, not the current directory.
Thanks,
Terrence
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Terrence, see if something towards the end of the Creating an Executable JAR thread doesn't help you out.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Imbedded jar file
 
Similar Threads
Jars inside one jar?
Jar file problems
jar files
How classpath works for executable Jars
Using a directory inside of a JAR file