*
The moose likes Java in General and the fly likes setting  classpath jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "setting  classpath jar" Watch "setting  classpath jar" New topic
Author

setting classpath jar

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi I have a jar file which contains relavent libraries inside its lib folder.

for one jar file I have set the manifest file like this
Class-Path: log4j-1.2.13.jar
to keep multiple jar file in classpath what should i do
or any other idea like jar dependency while creating jar.
(dont know how to create this jar dependcy)

regards
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
I don't think you can nest the jars. You can put them next to each other and let an executable jar point to the neighbouring jars using the classpath manifest entry.

So you "MUST" have an executable jar for this, otherwise it won't work.
Example manifest:

Manifest-Version: 1.0
Main-Class: com.test.Start
Class-Path: jar1.jar jar2.jar jar3.jar

So put all the jars in one directory and then execute the executable jar (containing the manifest).

PS. I use Ant to create my jars (integrated in eclipse).
Jar file specification
arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
thanks it worked
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
I tried to do this from Eclipse. But it didn't work. I make a jar of all the lib files and "Added External Jars" to the project. But, when I removed the lib files, Eclipse couldn't find the relevant lib files.

Do I need to add a classpath variable that points to the .jar file specifically or make it executable like you mentioned above?

Thanks in advance.

Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting classpath jar
 
Similar Threads
Package javax.servlet, javax.servlet.http does not exist
ejb 3.0,jboss 4.2.2 netbeans 6.0.1
NoClassDefFoundError
using command to run swing application ?
Jar file problem