Direct answer

“Could not find or load main class” usually means Java is being asked to launch a class name instead of a valid executable server JAR, or the classpath/main-class argument is wrong.

What it means

java -jar uses the JAR manifest; java -cp expects a class name. Mixing the two forms or launching from the wrong working directory causes this error before world loading.

If you are a player

  • Identify whether the startup panel expects a JAR filename or an entire launch command.
  • Record the literal startup command and file listing without sharing credentials.

If you run the server

  1. Use pwd and ls -l (Linux) or dir (Windows) to confirm the working directory and exact JAR filename.
  2. For a normal executable server JAR, use java -jar server.jar nogui with the actual filename.
  3. For Forge/NeoForge installs that generate launcher arguments or run scripts, use their generated startup method instead of forcing an arbitrary JAR.
  4. Check whether shell quoting or an accidental extra token makes Java interpret your flags as a class.

Confirm the fix: Confirm the next startup reaches the Minecraft/loader log. A missing main class is not repaired by increasing RAM.

Current Paper Java requirements

Paper currently documents Java 21 for Paper 1.20 through 1.21.11 and Java 25 for Paper 26.1+. Other server software or older Minecraft versions can require a different Java release, so check that project’s exact version table.

References

Use the documentation for the exact software and release you run. These sources support the settings or diagnostic behavior used in this fix.

Was this article helpful?
Help us improve this article

Tell us what is missing, unclear, outdated, or incorrect. You can also suggest something we should add.

What could we improve?
Do not include passwords, server IPs, or other private information.0 / 1000