使用 Java 开发并生成 .jar 文件

1. 编写文件 D: estHello.java:

1 package test;
2 
3 public class Hello
4 {
5     public static void main(String argv[])
6     {
7         System.out.println("Hello, world");
8     }
9 }

2. 编译,得到 Hello.class 文件。

 1 D:>javac -target 1.2 test/Hello.java 

3. 使用 jar.exe 工具生成 test.jar 文件

 1 D:>jar cvf test.jar test/Hello.class 

jar2exe:

http://www.regexlab.com/zh/jar2exe/demo1.htm

原文地址:https://www.cnblogs.com/CharlesGrant/p/4081621.html