Eclipse error “Could not find or load main class”

后端 未结 26 1457
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 01:31

I know there are many duplicates of this question, but I have looked at them all, and none of them have solved the issue.

I am trying to run a class that has a main

26条回答
  •  失恋的感觉
    2020-12-07 01:36

    I also had the same issue and was getting "Error: Could not find or load main class ...."

    I solved it as follows:

    1. Right clicked on my Java main class > Run As > Run Configurations.

    2. In the resultant popup box and Under Java Application your java file name would be selected mode... if not select it

    3. On the right side of the same box and under Classpath tab Clear all Bootstrap and User Entries (if any)
    4. Under Bootstrap Entries Click Advanced Button > Select Add Library Radio and click OK. In next "Add Library" box Select JRE System Library and provide your correct JRE location and click Finish. (If it is not visible then u have to add it by clicking Installed JRE > Add button). Now you can see JRE System Library under BootStrap Entries

    5. Next User Entries > Click Add Projects Button > And then under Project Selection box check on your Project name > OK

    The main java file should now work. Hope this may help someone who would be facing similar issues.

提交回复
热议问题