title: Manual setting CLASSPATH with -cp or -classpath does not work as expected
body: <p>MyClassWithMainMethod.java uses classes of someJar.jar.</p>
  
  <p>If I call:</p>
  
  <pre><code>java -cp someJar.jar MyClassWithMainMethod
  </code></pre>
  
  <p>I get the exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: MyClassWithMainMethod
  Caused by: java.lang.ClassNotFoundException: MyClassWithMainMethod
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
  </code></pre>
  
  <p>But when I set the CLASSPATH to my jar manually</p>
  
  <pre><code>export CLASSPATH=:/path/to/someJar.jar
  </code></pre>
  
  <p>it works calling</p>
  
  <pre><code>java MyClassWithMainMethod
  </code></pre>
  
  <p>What am I doing wrong?</p>