This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Alternate drives in Jar file Class-Path attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Alternate drives in Jar file Class-Path attribute" Watch "Alternate drives in Jar file Class-Path attribute" New topic
Author

Alternate drives in Jar file Class-Path attribute

Fritz Todd
Greenhorn

Joined: Apr 13, 2007
Posts: 7
Hello, all. I am working on a project that I would like to package into a single jar file for simple execution. At work classes from EJB are stored on a different drive from where I am doing the development. I am having troubles accessing those classes from the Jars I am creating. When I try the following manifest:

Main-Class: MyPackage.MyClass
Class-Path: U:\someFolder

the application will not start, saying that MyPackage.MyClass cannot be found. This is despite MyPackage.MyClass being properly packaged into the Jar file, as verified by a jar t operation. When I leave off the drive letter in the Class-Path attribute:

Main-Class: MyPackage.MyClass
Class-Path: someFolder

the application starts and executes properly right up until a class from someFolder is needed, at which point exceptions begin to be thrown.

Any ideas will be much appreciated!
John Todd
Fritz Todd
Greenhorn

Joined: Apr 13, 2007
Posts: 7
I was eventually able to find the answer to my own question: Jars do not accept absolute paths at all, only relative paths. Thus, the alternate drive approach will not work. Fortunately I was able to find an alternate solution.

John Todd
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alternate drives in Jar file Class-Path attribute
 
Similar Threads
Log4J configuration problem
packaging
Jar Manifest ClassPath Atribute
Creating a Jar (NON executable) with all the dependencies
ClassNotFoundException on main class in executable Jar file