Java“找不到主类”等等等等,但是有些奇怪的事情:
所以。我编译一个 .jar 文件。我知道我的清单是正确的。主类称为“Boot”。每当我尝试运行 .jar 时,都会收到以下错误:无法找到主类:
我不知道是什么原因造成的。另外,我发现了一些奇怪的事情:如果我使用 7-zip(WinZip 的替代方案)打开文件并导航到主类,则没有名为 Boot.class
的文件。有两个文件:Application.class
和 Application$1.class
。有谁知道发生了什么以及如何解决? :\
编辑我刚刚意识到目录中还有另一个 .java,因为 Boot.java
被称为 Aplication.java
。所以我猜 Boot.java
只是没有被编译? :\
So. I compile a .jar file. I know I have the Manifest correct. The main class is called "Boot." Whenever I try to run the .jar, I get the following error: Could not find the main class: <classdir>.Boot. Program will exit.
I have no idea what is causing it. Also, I found something strange: If I open the file with 7-zip (alternative to WinZip) and navigate to the main class, there isn't a file called Boot.class
. There are two files: Application.class
and Application$1.class
. Does anyone have an idea as to what is happening and how to fix? :\
EDIT I just realized that there was another .java in the directory as Boot.java
was called Aplication.java
. So I guess Boot.java
just isn't getting compiled? :\
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查以下任何一项是否有效:
这将告诉您 Manifest 是否有效错了或者 Boot.java 不存在。然后根据情况进行修复。
You should check if any of these work:
This will tell you if the Manifest was wrong or the Boot.java wasn't there. Then fix as appropriate.