1. linux必须已安装java环境,测试
javac -version
javac 1.8.0_20
说明java环境已安装好了
2. 建立目录helloworld,在目录下建立helloworld.java文件
cd ~
mkdir helloworld
cd helloworld
vi helloworld.java
helloworld.java内容如下
public class helloworld {
public static void main(String[] args) {
System.out.println("Hello World!!");
}
}
把helloworld.java 打包成可执行的jar
javac helloworld.java
ls
echo Main-class: helloworld > manifest.txt
ls
cat manifest.txt
jar cvfm hello.jar manifest.txt helloworld.class
运行hello.jar文件
java -jar hello.jar
hello world!!
Comments | NOTHING