C:\JarTest\T\InputDialogDemo.java 内容
引用:package T;
import javax.swing.JOptionPane;
public class InputDialogDemo {
/** Main method */
public static void main(String[] args){
// Prompt the user to enter a year
String yearString = JOptionPane.showInputDialog(null,"Enter a year", "Input (int)", JOptionPane.QUESTION_MESSAGE);
}
}
编译成InputDialogDemo.class
建立文件
C:\JarTest\manifest.mf内容
Manifest-Version: 1.0
Created-By: xyz
Main-Class: T.InputDialogDemo
在C:\JarTest输入命令 jar cvfm test.jar manifest.mf T
需要注意的是:
1. T必须与包名一致(包括大小写);
2. The manifest file name and the archive file name needs to be specified in the same order the 'm' and 'f' flags are specified.
这样就会生成test.jar,双击就会运行。
这样后就可以使用exe4j等打包成exe文件