title: Compiling and running a java program with complex file structure from the commandline
body: <p>Trying to compile and run my java program from the commandline that is set up a bit weird.  The file structure is as follows:</p>
  
  <pre><code>[ROOT]/
  |
  |____libs/
  |    |____myExtraJar.jar
  |     
  |____src/
       |____main/
            |____com/
                 |____example/
                      |____myClass.java
  </code></pre>
  
  <p>The package is defined at the top of the java file as</p>
  
  <pre><code>package com.example;
  </code></pre>
  
  <p>I am able to compile the program fine (I think) while in the root folder, using</p>
  
  <pre><code>javac -classpath "/libs/myExtraJar.jar" src/main/com/example/*.java
  </code></pre>
  
  <p>I don't get any compilation errors (such the ones that occur if I leave off the classpath) and I can see that .class files are being created in the com/example/ folder.  However, I can't find any way to run the compiled program.  Running</p>
  
  <pre><code>java src/main/com/example/myClass
  </code></pre>
  
  <p>results in the message</p>
  
  <pre><code>Error: Could not find or load main class src.main.com.example.myClass
  </code></pre>
  
  <p>Any help would be appreciated.</p>