title: "Could not find the main class"
body: <p>I'm trying to run a sample Java application from the command promopt but I'm getting the following error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/helloworld/HelloWorldDesktop
  Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.helloworld.HelloWorldDesktop
          at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  Could not find the main class: com.badlogic.gdx.helloworld.HelloWorldDesktop.  Program will exit.
  </code></pre>
  
  <p>The command I'm using to try and run this app is:</p>
  
  <pre><code>java -cp .;gdx.jar;gdx-backend-jogl.jar com.badlogic.gdx.helloworld.HelloWorldDesktop
  </code></pre>
  
  <p>Where all relevant files are in the current working directory (.java, .class and .jar files)</p>
  
  <p>The command I used to build the .class files was as follows (there are 2 .java files):</p>
  
  <pre><code>javac -cp gdx.jar;gdx-backend-jogl.jar HelloWorld.java HelloWorldDesktop.java
  </code></pre>
  
  <p>Again this was run from the same working directory - The contents of <code>HelloWorldDesktop.java</code> is (more or less):</p>
  
  <pre><code>package com.badlogic.gdx.helloworld;
  
  public class HelloWorldDesktop {
      public static void main (String[] argv) {
          // Application
      }
  }
  </code></pre>
  
  <p>I'm attempting to learn Java as a C# developer, so wheras I have a strong background in programming concepts the whole java toolchain is currently completely confusing me.  The exception indicates that the class <code>HelloWorldDesktop</code> couldn't be found, but as far as I can tell I've got the correct name and I've added the correct .jar files to the class path and so Java should be able to load this class.</p>
  
  <p>Why can't it find <code>HelloWorldDesktop</code>?</p>