Netbeans – Error: Could not find or load main class

  1. Right click on your Project in the project explorer
  2. Click on properties
  3. Click on Run
  4. Make sure your Main Class is the one you want to be the entry point. (Make sure to use the fully qualified name i.e. mypackage.MyClass)
  5. Click OK.
  6. Clean an build your project
  7. Run Project 🙂

If you just want to run the file, right click on the class from the package explorer, and click Run File, or (Alt + RF), or (Shift + F6)

Leave a Comment