Netbeans - Error: Could not find or load main class

前端 未结 21 2065
时光说笑
时光说笑 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:05

    If none of the above works (Setting Main class, Clean and Build, deleting the cache) and you have a Maven project, try:

    mvn clean install
    

    on the command line.

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

    I have run into this error a couple of times as well and for me the above solutions did not work. What does seem to work is going to the Project Properties, and under Compiling toggling Compile on Save.

    0 讨论(0)
  • 2020-11-28 16:07
    1. close netbeans.
    2. open netbeans again.
    3. choose new project>>java application.
    4. click next.
    5. deselect create main class.
    6. now make the application clean build run

    For more reference watch this video

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

    Using NetBeans 8.1, I got the dread

    Error: Could not find or load main class 
    

    from carelessly leaving an empty line in the Project Properties > Run > VM Options field. Until you click in the field, you may not see the caret flashing out of place. Remove the empty line to restore equanimity.

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

    I had the same problem and I moved the project to a location where the path had no none-english letter and that fixed the problem

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

    Try to rename the package name and the class/jframe names... The clean and build the application.

    1. Right Click on the package name
    2. Go to Refactor
    3. Select Rename
    4. Give it a meaningful name, preferably all in small letters
    5. Click on Refactor

      Do the same for the class/jframe names.

    6. Last Select Run from Menu 7.Select Clean and build main project

    That should do it!!! All best

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