How to make an executable jar file?_jar包

How to make an executable jar file?_jar_02

文件的路径如下:

How to make an executable jar file?_ide_03

 



package com.tellidea;

public class Temp{
public static void main(String args[]){
System.out.println(args[0]);
}
}


 How to make an executable jar file?_vim_04

 直接vim myjar.jar 打开jar包,查看里面的内容:

How to make an executable jar file?_ide_05

MANIFEST.MF文件的内容:

How to make an executable jar file?_jar_06

 

 

 

---------------------------------------------------------------

Here it is in one line:

jar cvfe myjar.jar package.MainClass *.class


where ​​MainClass​​ is the class with your ​​main​​ method, and ​​package​​ is ​​MainClass​​'s package.

Note you have to compile your ​​.java​​ files to ​​.class​​ files before doing this.