aspose file tools
The moose likes Beginning Java and the fly likes jar classpath help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "jar classpath help" Watch "jar classpath help" New topic
Author

jar classpath help

Ellen fish
Greenhorn

Joined: Oct 28, 2008
Posts: 27
Hello,

I have a d.jar containing

MANIFEST.MF
a.jar
b.jar
c.jar
main.class

My MANIFEST.MF is

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 11.0-b15 (Sun Microsystems Inc.)
Main-Class: RAPTestTool
Class-Path: a.jar b.jar c.jar

but when I call java -jar d.jar I'm still getting no class found. Did I not add these jar file in my classpath properly?

Any help will be greatly appreciated. Thank you

just an extra question how can I create a folder and move a.jar b.jar c.jar there?

Thank you thank you
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16811
    
  19

The classpath variable (either environment or in the manifest) is used to find jar files in the local directories. The JVM doesn't search for jar files inside other jar files.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ellen fish
Greenhorn

Joined: Oct 28, 2008
Posts: 27
ohh I see..
Then is there any way to group all the jars and the class together to make it a single executable jar or something else?
Thank you soooooo much for your help

[ November 26, 2008: Message edited by: Ellen fish ]
[ November 26, 2008: Message edited by: Ellen fish ]
Brian Lang
Ranch Hand

Joined: Oct 21, 2008
Posts: 43
Originally posted by Ellen fish:
Then is there any way to group all the jars and the class together to make it a single executable jar or something else?


Search for 'java jar rejar' on Google. I personally think distributing your application jar in a directory with a simple 'lib' subdirectory (containing the linked jar files) is easier and neater, but it can be done.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32830
    
    4
Originally posted by Brian Lang:
Search for 'java jar rejar' on Google.


I tried just that and got this as the first hit
Brian Lang
Ranch Hand

Joined: Oct 21, 2008
Posts: 43
Heh. Yeah, that Google engine works quickly.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: jar classpath help
 
Similar Threads
Setting classpath for Jar file inside jar file
Running with jar files in jar file.
merge multiple jars into one jar?
setting classpath for jar file inside jar file
Manifest file not working in J2EE project?