Here is an example for creating a JAR file using the GNU ZIP command (available for Win32 from
http://unxutils.sourceforge.net/ ).
I have the following files enumerated by the DIR command:
C:\demo1>dir /s /b
C:\demo1\META-INF
C:\demo1\MyClass.class
C:\demo1\MyClass.java
C:\demo1\META-INF\MANIFEST.MF
MANIFEST.MF contents:
Main-Class: MyClass
MyClass.java contents (class has no package declaration; is in the default package):
public class MyClass {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
I create the JAR using the ZIP command (you probably don't want the Java source code in it, but it does no harm):
C:\demo1>zip -r ..\myjar.jar *
adding: META-INF/ (244 bytes security) (stored 0%)
adding: META-INF/MANIFEST.MF (164 bytes security) (deflated 10%)
adding: MyClass.class (164 bytes security) (deflated 31%)
adding: MyClass.java (164 bytes security) (deflated 12%)
This can be run thus:
C:\>java -jar C:\myjar.jar
Hello, World!
---------------------------------
HOWTO ask questions: http://catb.org/~esr/faqs/smart-questions.html