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

后端 未结 30 1977
不知归路
不知归路 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条回答
  •  Happy的楠姐
    2020-11-21 22:48

    That should have been java -jar app.jar instead of java -jar "app".

    The -jar option only works if the JAR file is an executable JAR file, which means it must have a manifest file with a Main-Class attribute in it. See Packaging Programs in JAR Files to learn how to create an executable JAR.

    If it's not an executable JAR, then you'll need to run the program with something like:

    java -cp app.jar com.somepackage.SomeClass
    

    where com.somepackage.SomeClass is the class that contains the main method to run the program. (What that class is depends on the program, it's impossible to tell from the information you've supplied).

提交回复
热议问题