This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Creating a Jar from other Jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Creating a Jar from other Jar files" Watch "Creating a Jar from other Jar files" New topic
Author

Creating a Jar from other Jar files

Ali Ekber
Ranch Hand

Joined: Jun 12, 2005
Posts: 41
I want to include jar files in a new Jar file I want to create. Here is the command I am trying:

jar cmf mainClass SOAPClient.jar com/company/client/ soap.jar activation.jar mail.jar

When I create this jar file and run it, I get this error:

java -jar SOAPClient.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException

So, obviously mail.jar is not included in the file correctly (wrong classpath??). How can I include mail.jar activation.jar and soap.jar in this new jar file?

Thx.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

You include those three jar files in the outer file exactly the way you did it. That part works fine. But then there is no way to declare the classpath so that it includes those three jar files, so it is pointless to do so.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
>How can I include mail.jar activation.jar and soap.jar in this new jar file?

You can't. There is no provision for the java command to look for jar files inside of another jar file. All the jar files MUST be as separate files in some folder.
See the Class-path: entry in the manifest as one possiblity.
Or use a full commandline: java -classpath <all the jars> <program>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a Jar from other Jar files
 
Similar Threads
Html Format Mail
Problem creating a SOAP connection
how to acess webservice in java
HTTP Status 404 - /soap/ - when executing soap webapp
Sending an AutoGenerated Email