Failed to load Main-Class manifest attribute

后端 未结 6 1832
粉色の甜心
粉色の甜心 2021-01-25 16:45

I know this is a very common question, but I tried googling and got no helpful result. I\'m trying to make a jar out of my \"Main.class\" file (made in NetBeans, but I\'m not tr

6条回答
  •  轮回少年
    2021-01-25 17:21

    Extract the mainifest file.

    Add an extra line so it says :

    Manifest-Version: 1.0
    Created-By: 1.6.0_22 (Sun Microsystems Inc.)
    Main-Class: Main
    

    Make sure there is two newline characters at the end.

    Update the jar file. You could either have edited the Manifest in the jar file with WinRAR, 7-zip, etc. or you could have deleted the original jar (after extracting and editing) then ran

    jar -cmf MANIFEST.MF trovanum.jar *.class
    

    Then it would use your newly modified manifest in the jar.

提交回复
热议问题