This article may be helpful if you have tried online those methods that are still wrong:
Install JRE, JDK in different folder
Change Classpath
CMD run java-version and Javac-version show the same version
Today, when you write Java code, click the green arrow in the menu bar and prompt in the console
Error: Unable to load main class
Blink of an instant, before the operation is good (right-click the project, run as application), how can not now
and take out the separate Java files, go to cmd under Javac, Java Run, or not
Then Baidu, learned that severed Java file package a packet, then to CMD run, you must follow the following steps:
First of all
Javac Javaname.java
Post-CD. Go back to the previous level directory and
java packagename.javaname
如此运行后发现成功,纳闷,再返回eclipse还是无法加载主类
Finally found that I do not know what year and month my run by default is not the current Java file, but another deleted Java
Click Run configuration (running config)
In the Out of the dialog box appears not this file, delete it as empty, apply can
Eclipse cannot load main class