How to run a JAR file

前端 未结 11 2304
长发绾君心
长发绾君心 2020-11-22 04:18

I created a JAR file like this:

jar cf Predit.jar *.*

I ran this JAR file by double clicking on it (it didn\'t work). So I ran it from the

11条回答
  •  借酒劲吻你
    2020-11-22 04:36

    Java

    class Hello{
       public static void main(String [] args){
        System.out.println("Hello Shahid");
       }
    }
    

    manifest.mf

    Manifest-version: 1.0
    Main-Class: Hello
    

    On command Line:

    $ jar cfm HelloMss.jar  manifest.mf Hello.class 
    $ java -jar HelloMss.jar
    

    Output:

    Hello Shahid
    

提交回复
热议问题