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
问题描述
我刚刚开始学习Java编程,我已经使用Net-beans IDE创建了一个简单的游戏.我想把它展示给我的朋友,所以我将它内置到一个.jar中.根据Net bean生成的自述文件,我尝试使用
I have just began learning Java programming, I have created a simple game using Net-beans IDE. I wanted to show it to my friends, so I built it into a .jar. As per the readme that Net beans generates, I attempted to run the .jar with
java -jar"gameTest.jar"
但是我收到错误消息:无法加载Main-Class清单属性".
However I get the error: "Failed to load Main-Class manifest attribute".
现在不仅这个jar无法运行,而且我以前没有问题地运行过的其他jar都以相同的方式失败了.例如,我有Minecraft,运行的是.jar发行版,因此我可以通过.bat文件为HD纹理分配更多的内存.但是当我打开它时,它也会产生同样的错误.而且我知道这没什么问题.
And now not only will this jar not run, others that I have previously run without issue are failing in the same way. Fir example I have Minecraft, running off the .jar distribution so I can give it more memory trough a .bat file for HD textures. But it also generates this same error when I open it. And I know that there is nothing wrong with it.
我在网上找到的有关此错误的所有信息都表明清单存在问题,但是对于计算机上的所有.jar文件(尤其是那些我已经在其中多次使用的文件)而言,这可能不是正确的.过去没有问题.操作系统或Java安装中肯定有错误.
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. There must be something in the OS or java instalation that is wrong.
Win7 x64Java 6 x32JRE 6
Win7 x64 Java 6 x32 JRE 6
推荐答案
由于某种原因,重新安装JRE和JDK(按此顺序)似乎已解决了该问题.
It seems that, for whatever reason, re-installing both JRE and JDK (in that order) has fixed the problem.
不知道原因.
这篇关于Java“无法加载Main-Class清单属性".在任何.jar文件上,即使是我之前成功打开过的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!