The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


How to create JAR-Files with Packages

Posted by Martin Gineiger on August 16, 2001 at 3:28 AM

> I have a directory called program6
> and inside i have 4 packages.
> One of the packages have my main method in it which
> will execute the program on demand.

> How would i create an executable jar with this???

You should start at the classpath-folder. From there, you can add files to the jar-file by using the relative file name. For example:
jar cvf test.jar myPackage/*.class
Take care that you use
Main-Class: myPackage.MyClass.class
in the Manifest-File


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us