Netbeans - Error: Could not find or load main class

前端 未结 21 2067
时光说笑
时光说笑 2020-11-28 16:01

So I\'m making a java application in Neatbeans 7.4, been working at it for a while, everything was fine, running the project worked fine, but now when I hit run project, I g

相关标签:
21条回答
  • 2020-11-28 16:14

    Sometimes due to out of memory space error, NetBeans does not load or find main class.

    If you have tried setting the properties and still it is not working then try

    1. Select the project from the project explorer
    2. Click on Run in the Menu Bar
    3. Click on Compile

    It worked for me.

    0 讨论(0)
  • 2020-11-28 16:16

    You can solve it in these steps

    1. Right-click on the project in the left toolbar.
    2. Click on properties.
    3. Click on Run
    4. Click the browse button on the right side.(select your main class)
    5. Click ok
    0 讨论(0)
  • 2020-11-28 16:19
    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 + R, F), or (Shift + F6)

    0 讨论(0)
  • 2020-11-28 16:19

    Had the same problem here. Usually Clean and Build solves much of the problem. It happened to be caused by a wrongly installed plugin.

    0 讨论(0)
  • 2020-11-28 16:20

    Just close the Netbeans. Go to C:\Users\YOUR_PC_NAME\AppData\Local\Netbeans and delete the Cache folder. The open the Netbeans again and run the project. It works like magic for me.

    (AppData folder might be hidden probably, if so, you need to make it appear in Folder Options).

    0 讨论(0)
  • 2020-11-28 16:20

    Possible Fixes:

    Fix 1

    1. Go to project properties (right click on the folder of your project in netbeans)
    2. On left tab where it shows the categories, click on the "Run" selection
    3. Then click on Browse to find the Main class you use on your project

    Fix 2

    1. Go to C:\Users\name\AppData\Local\Netbeans
    2. delete the Cache folder.
    3. Rebuild and Run

    Fix 3 Download most recent version of Netbeans

    Fix 4 Download most recent version of JDK and configure Netbeans to use that

    0 讨论(0)
提交回复
热议问题