简体   繁体   中英

Java “Could not find main class” blah blah blah, but something strange:

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. 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? :\\

You should check if any of these work:

  • "java -jar your.jar Boot"
  • unpack the jar file (any unzip will work), cd into the root folder, and run it with "java Boot"

This will tell you if the Manifest was wrong or the Boot.java wasn't there. Then fix as appropriate.

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