热门关键字: jsp web pl/sql pl webwor   →开发工具  操作系统
当前位置 : 无忧IT编程网 > Java开发 > 网络编程 > 正文

将java程序打包成“可执行”文件示例

时间:07-10-31
----摘抄
建立文件
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文件
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 验证码: 验证码
查看所有评论
站长推荐