title: NoClassDefFoundError on HelloWorld program
body: <p>I've looked through the other NoClassDefFoundError questions and not found a solution that works for me. I'm using the Eclipse IDE to write a program, and it runs fine when I right-click -> Run as Java application in Eclipse, but attempting to run it through the command line runs into the above error. The JRE I'm using is (I think) Java60. The program is compiled using javac HelloWorld.java which runs fine, then a call to java -cp . HelloWorld throws the error. Any help with troubleshooting this would be much appreciated.</p>
  
  <p>Code is:</p>
  
  <pre><code>package tool;
  
  public class HelloWorld {
  
  public static void main(String[] args){
      System.out.println("Hello World!");
  }
  
  }
  </code></pre>
  
  <p>Running from "C:\MADtool\HostDBtoMADTool\src\tool"</p>
  
  <p>Output from the command line is:</p>
  
  <pre><code>C:\MADtool\HostDBtoMADtool\src\tool&gt;java -cp . HelloWorld
  Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong nam
  e: tool/HelloWorld)
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
  </code></pre>