How to make an executable jar file?

https://stackoverflow.com/questions/5258159/how-to-make-an-executable-jar-file

文件的路径如下:

package com.tellidea;

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

 

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

MANIFEST.MF文件的内容:

 

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

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.

原文地址:https://www.cnblogs.com/oxspirt/p/9377400.html