Java problem: Could not find main class HelloWorld
<p>I am new to java(a real novice). </p>

<p>I installed Java 1.7.0 in the following folder <code>C:\Program Files\Java</code></p>

<p>The environment variable which I set are</p>

<p><strong>CLASSPATH</strong> : <code>C:\Program Files\Java\jdk1.7.0\jre\lib\rt.jar;</code></p>

<p><strong>Path :</strong> <code>C:\Program Files\Java\jdk1.7.0\bin;</code></p>

<p><strong>JAVA_HOME</strong> : <code>C:\Program Files\Java;</code></p>

<p>I have presented here the class names which are in my system. </p>

<p>Next I wrote a program(HelloWorld.java)</p>

<pre><code>import java.io.*;

class HelloWorld
{
    public static void main(String[] args) 
    {
        System.out.println("Hello World!");
    }
}
</code></pre>

<p>When I am compiling using <code>javac HelloWorld.java</code> it is compiling fine.</p>

<p>But after I issue <code>java HelloWorld</code> I am encountering the below error</p>

<pre><code>Error: Could not find main class HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:198)

Caused by: java.lang.ClassNotFoundException: HelloWorld
        at java.net.URLClassLoader$1.run(URLClassLoader.java:299)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:288)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:287)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:422)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:355)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:195)
</code></pre>

<p>After a bit of google search I found that may be something wrong in the environment variable. I tried to play with that but no luck.</p>

<p>I know that it may be a very simple thing for the real java developers(actually basic)  but  for me as of now no luck!</p>

<p>I even RESTARTED the machine and then again I tried to run but with same fate.</p>

<p><strong>OS</strong>: <code>Windows XP(Version 2002) with  Service pack 3</code></p>

<p>Help needed .</p>

<p>Thanks .</p>
