Why do I get "Error: Could not find or load main class" for any java code? : <p>Any java code I compile and try to execute from CMD line results in the error: <br>
<strong>Error: Could not find or load main class</strong></p>

<p>I have tried setting environment variables:<br>
PATH=C:\Program Files\Java\jdk1.8.0_202\bin<br>
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_202</p>

<p>and with and with out:<br>
CLASSPATH=C:\Program Files\Java\jdk1.8.0_202\jre\lib  or<br>
CLASSPATH=C:\Program Files\Java\jdk1.8.0_202\jre\lib\rt.jar or<br>
CLASSPATH=(directory of code)</p>

<p>The following is an example of a simple test prog that will not run:</p>

<pre><code>/**
 * Experiment with println() and print()
 */
public class HelloGoodbye 
{   
    public static void main(String[] args) 
     { 
        System.out.println("My First Hello!");
        System.out.println("Hello again!");
        System.out.print("Hello finally!");
        System.out.print("Goodbye!");
    }
}
</code></pre>

<p>This produces:
    Error: Could not find or load main class</p>
