Can't execute jar- file: “no main manifest attribute”

后端 未结 30 1907
不知归路
不知归路 2020-11-21 22:30

I have installed an application, when I try to run it (it\'s an executable jar) nothing happens. When I run it from the commandline with:

java -jar \

30条回答
  •  渐次进展
    2020-11-21 22:49

    Since you've add MANIFEST.MF, I think you should consider the order of Field in this file. My env is java version "1.8.0_91"

    and my MANIFEST.MF as here

    // MANIFEST.MF
    Manifest-Version: 1.0
    Created-By: 1.8.0_91 (Oracle Corporation)
    Main-Class: HelloWorldSwing
    
    // run
    ~ java -jar HelloWorldSwing.jar
    no main manifest attribute, in HelloWorldSwing.jar
    

    However, this as below run through

    Manifest-Version: 1.0
    Main-Class: HelloWorldSwing
    Created-By: 1.8.0_91 (Oracle Corporation)
    
    //this run swing normally
    

提交回复
热议问题