简体   繁体   中英

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

I have Server.Launcher class in a jar file. 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. Except it is in the jar, and manifest is correct.

I am compiling the Jar on linux and running it on Windows.

Is it possible that some other missing class leads to this error? 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

Edit2:

Ok. The problem is with two Jars I tried bundling up. Guess they had some unmet dependencies or something. Not sure how to fix it cause I need those jars.

Just grab the source code for each of the JARs, and compile them together. Also, for good practice, do -jar instead of - jar .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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