简体   繁体   English

即使清单正确,Java 也无法找到或加载主 class

[英]Java couldn't find or load main class even if manifest is correct

I have Server.Launcher class in a jar file.我在 jar 文件中有 Server.Launcher class 。 Everything was working great - until it didn't.一切都很好 - 直到它没有。

Perhaps the problem is with new libraries I tried or some configuration error - but either也许问题在于我尝试过的新库或一些配置错误 - 但要么

java - jar JavaServer.jar

or或者

java -cp JavaServer.jar Server.Launcher

return the same problem - Server.Launcher class missing.返回同样的问题 - Server.Launcher class 丢失。 Except it is in the jar, and manifest is correct.除了它在 jar 中,并且清单是正确的。

I am compiling the Jar on linux and running it on Windows.我正在 linux 上编译 Jar 并在 Windows 上运行它。

Is it possible that some other missing class leads to this error?是否有可能缺少其他一些 class 导致此错误? If so, is there any way to find out what is wrong?如果是这样,有没有办法找出问题所在?

Edit:编辑:

Here is my manifest file.这是我的清单文件。

Manifest-Version: 1.0
Main-Class: Server.Launcher

Main-Class: Server.Launcher主类:Server.Launcher

Edit2:编辑2:

Ok.好的。 The problem is with two Jars I tried bundling up.问题在于我尝试捆绑的两个 Jars。 Guess they had some unmet dependencies or something.猜猜他们有一些未满足的依赖关系或其他东西。 Not sure how to fix it cause I need those jars.不知道如何修复它,因为我需要那些 jars。

Just grab the source code for each of the JARs, and compile them together.只需获取每个 JARs 的源代码,然后将它们一起编译。 Also, for good practice, do -jar instead of - jar .此外,为了获得良好的实践,请使用-jar而不是- jar

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

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