How to open/run .jar file (double-click not working)?

前端 未结 15 1151
陌清茗
陌清茗 2020-12-15 17:26

I can\'t open or run my .jar file.

I just installed java, but I tried to open the .jar with other programs first, so the double-click defaults to something else and

15条回答
  •  孤城傲影
    2020-12-15 17:51

    You must create a manifest file and specify your class that has the main method. you can build your jar file with manifest file as a parameter.

    jar cfm MyJar.jar Manifest.txt MyPackage/*.class
    
    Manifest-Version: 1.0
    
    Archiver-Version: Plexus Archiver
    
    Created-By: Apache Maven
    
    Built-By: Cakes
    
    Build-Jdk: 1.6.0_04
    
    Main-Class: com.foo.App
    

提交回复
热议问题