How to solve Could not find or load main class
$ java helloworld
Error: Could not find or load main class helloworld
Reason 1 – Made a mistake with the classname argument
a simple class name:
java ListUser
When the class is declared in a package such as com.acme.example, then you must use the full classname including the package name in the java command; e.g.
java com.acme.example.ListUser
Reason 2 – the application’s classpath is incorrectly specified
The second likely cause is that the class name is correct, but that the java command cannot find the class. To understand this, you need to understand the concept of the “classpath”
From the desktop, right click the Computer icon.
1.Choose Properties from the context menu.
2.Click the Advanced system settings link.
3.Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
4.In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.