title: Compiling Java program with javac succeeds, but NoClassDefFoundError on run
body: <pre><code>class HelloWorld
  { 
      public static void main(String[] args) 
      { 
          System.out.println("hey");
      } 
  }
  </code></pre>
  
  <p>Command prompt session:</p>
  
  <pre><code>C:\Users\zobdos\Desktop&gt;javac HelloWorld.java
  
  C:\Users\zobdos\Desktop&gt;dir *.class
   Volume in drive C is OS
   Volume Serial Number is A45E-7B01
  
   Directory of C:\Users\zobdos\Desktop
  
  11/20/2010  10:16 AM               417 HelloWorld.class
                 1 File(s)            417 bytes
                 0 Dir(s)   8,145,432,576 bytes free
  
  C:\Users\zobdos\Desktop&gt;java HelloWorld
  Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
  Caused by: java.lang.ClassNotFoundException: HelloWorld
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClassInternal(Unknown Source)
  Could not find the main class: HelloWorld.  Program will exit.
  
  C:\Users\btolbert\Desktop&gt;
  </code></pre>