Failed to load Main-Class manifest attribute

后端 未结 6 1861
粉色の甜心
粉色の甜心 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:11

    You need to specify the Main-Class property in the manifest file: Understanding the Manifest. This usually means you need to add the manifest file yourself instead of letting it be added automatically.

    By the way you can always run your code without a manifest like this:

    java -cp path/to/myJar.jar my.package.MyClass 
    

    The manifest is required when you want to run it like this:

    java -jar path/to/myJar.jar
    

提交回复
热议问题