Try with this simple class
import java.awt.*;
import java.awt.event.*;
public class MyClass {
public static void main(String[] args) {
Frame f = new Frame();
f.addWindowListener
(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
);
f.add(new Label("Hello world"));
f.setSize(200,200);
f.setVisible(true);
}
} |
Manifest-Version: 1.0 Main-Class: MyClass Classpath: .\MyJar.jar |
jar cvfm MyJar.jar manifest.mft *.class |
java -jar MyJar.jar |
On NT, you can also make JARs run from the command-line by setting the PATHEXT environment variable, for example
set PATHEXT=.EXE;.BAT;.CMD;.JAR |
[ home ]