*
The moose likes Beginning Java and the fly likes jar classpath help 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 » Beginning Java
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: 18507
    
  40

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: 37926
    
  22
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.
 
jQuery in Action, 2nd edition
 
subject: jar classpath help
 
Similar Threads
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?
setting classpath for jar file inside jar file