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

后端 未结 30 2504
不知归路
不知归路 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

    (first post - so it may not be clean)

    This is my fix for OS X 11.6, Maven-based Netbeans 8.2 program. Up to now my app is 100% Netbeans - no tweaking (just a few shell escapes for the impossible!).

    Having tried most all of the answers here and elsewhere to no avail, I returned to the art of "use what works".

    The top answer here (olivier-refalo thanx) looked like the right place to start but didn't help.

    Looking at other projects which did work, I noticed some minor differences in the manifest lines:

    1. addClasspath, classpathPrefix were absent (deleted them)
    2. mainClass was missing the "com." (used the NB -> Project Properties->Run->Main Class->Browse to specify)

    Not sure why (I am only 3 months into java) or how, but can only say this worked.

    Here is just the modified manifest block used:

        
            mypackage.MyClass
        
    

提交回复
热议问题