aspose file tools*
The moose likes Java in General and the fly likes Creating a Jar (NON executable) with all the dependencies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Creating a Jar (NON executable) with all the dependencies" Watch "Creating a Jar (NON executable) with all the dependencies" New topic
Author

Creating a Jar (NON executable) with all the dependencies

Jayanath Amaranayake
Greenhorn

Joined: Dec 06, 2009
Posts: 7
Hi,
I have some set of utility java classes. They use commons bean utils and some other third party jar files. I created a jar of my utility classes (This jar is NOT executable as it contains only some utility classes that can be used by others) and added the Class-Path attribute to the manifest file at the time of the Jar file creation. However when another application is trying to use my utility classes jar, it fails with a ClassNotFound as my utility classes failed to find its dependencies.
May be I have missed something here. But below is a generic example of my scenario.

Utility.jar - has some utility classes and has no entry point with a main method
Dependancy1.jar - used in Utility.jar
Dependancy2.jar - used in Dependancy1.jar

Now, how should I create the Utility.jar properly, with all the dependencies.

Appreciate your help and many thanks for your time.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

Check out the Class-Path manifest property. It should be a location relative to the JAR file itself.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a Jar (NON executable) with all the dependencies