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

查看:408
本文介绍了Java“无法加载Main-Class清单属性”在任何.jar文件中,甚至是那些我之前成功打开的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习Java编程,我使用Net-beans IDE创建了一个简单的游戏。我想把它展示给我的朋友,所以我把它建成了一个.jar。根据Net beans生成的自述文件,我尝试使用

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 -jargameTest.jar

但是我收到错误:无法加载Main-Class清单属性。

However I get the error: "Failed to load Main-Class manifest attribute".

而现在不仅这个罐子不会运行,而且我以前没有遇到过的其他罐子也会以相同的方式失败。 Fir示例我有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 x64
Java 6 x32
JRE 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆