简体   繁体   English

Java“无法加载Main-Class清单属性”在任何.jar文件上,即使我之前成功打开过的文件也是如此

[英]Java “Failed to load Main-Class manifest attribute” On a any .jar file, even those that I have succeed in opening before

I have just began learning Java programming, I have created a simple game using Net-beans IDE. 我刚刚开始学习Java编程,我已经使用Net-beans IDE创建了一个简单的游戏。 I wanted to show it to my friends, so I built it into a .jar. 我想把它展示给我的朋友,所以我将它内置到一个.jar中。 As per the readme that Net beans generates, I attempted to run the .jar with 根据Net Bean生成的自述文件,我尝试使用

java -jar "gameTest.jar"

However I get the error: "Failed to load Main-Class manifest attribute". 但是我得到了错误:“无法加载Main-Class清单属性”。

And now not only will this jar not run, others that I have previously run without issue are failing in the same way. 现在,不仅这个jar无法运行,而且我以前没有问题的其他容器也以相同的方式失败。 Fir example I have Minecraft, running off the .jar distribution so I can give it more memory trough a .bat file for HD textures. 例如,我有Minecraft,运行的是.jar发行版,因此我可以通过.bat文件为HD纹理分配更多的内存。 But it also generates this same error when I open it. 但是当我打开它时,它也会产生同样的错误。 And I know that there is nothing wrong with it. 我知道这没有错。

All the things I have found online about this error say that there is a problem with the manifest, however this can not be true for all the .jar files on my computer, especially those that I have already used multiple times in the past without issue. 我在网上找到的有关此错误的所有信息都表明清单存在问题,但是对于计算机上的所有.jar文件(尤其是我过去已经多次使用而没有问题的文件),这可能不是正确的。 There must be something in the OS or java instalation that is wrong. OS或Java安装中一定存在错误。

Win7 x64 Java 6 x32 JRE 6 Win7 x64 Java 6 x32 JRE 6

It seems that, for whatever reason, re-installing both JRE and JDK (in that order) has fixed the problem. 似乎由于某种原因,重新安装JRE和JDK(按此顺序)已解决了该问题。

No idea of the reason. 不知道原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM