title: Java.lang.NoClassDefFoundError java.lang.StringBuilder from code using java.lang.StringBuffer
body: <p>I know there are plenty of questions regarding this error, but I haven't found it easy to find one exactly like mine.</p>
  
  <p>Here goes.</p>
  
  <p>I have a pretty small application that writes DB data to a csv file and then uploads it to a server. I have it running on my local box out of eclipse which is great, but the final version needs to be run as a cron job on a server box from command line.</p>
  
  <p>I'm working on the command line call for the main java class and its giving me lots of trouble.</p>
  
  <p>My dependency structure is as such:
  My classes</p>
  
  <ul>
  <li>package=gtechReconcile</li>
  <li>classes= GtechReconciler.java, CSVFile.java, QueryMachine.java, FTPSender.java</li>
  </ul>
  
  <p>My external libs</p>
  
  <ul>
  <li>ojdbc14.zip</li>
  <li>edtftpj.jar</li>
  </ul>
  
  <p>I run the following line in the terminal in the directory above the compile source package (ie /path/to/classes where /path/to/classes/gtechReconcile/ has all the compiled class files) This path is the current directory when the command line is run :</p>
  
  <pre><code>java -cp /&lt;snip&gt;/lib/ojdbc14.zip:/&lt;snip&gt;/lib/edtftpj.jar:/path/to/classes gtechReconcile.GtechReconciler
  </code></pre>
  
  <p>The error then tells me it can't find java.lang.StringBuilder, even though this does not exist in my code. I use a StringBuffer, which apparently StringBuilder has replaced since Java5. Perhaps the java compiler converted this to StringBuilder, which the jvm then does not resolve?</p>
  
  <p>What am I missing here?</p>
  
  <p>EDIT : added error from prompt (clarified where this executes from and what is present in the package folder):</p>
  
  <pre><code>[gtechReconcile]$ pwd
  /path/to/
  [gtechReconcile]$ cd classes/gtechReconcile/
  [gtechReconcile]$ ls
  CSVFile.class  FTPSender.class  GtechReconciler.class  QueryMachine.class  reports
  [gtechReconcile]$ cd ..
  [classes]$ ls
  gtechReconcile
  [classes]$ java -cp .:/path/to/lib/ojdbc14.zip:/path/to/lib/edtftpj.jar gtechReconcile.GtechReconciler
  Creating file
  Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: gtechReconcile.CSVFile
  at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
  at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
  at gtechReconcile.GtechReconciler.main(java.lang.String[]) (Unknown Source)
  Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in [file:./, file:/opt/mms_tstt2/gtechReconcile/lib/ojdbc14.zip, file:/opt/mms_tstt2/gtechReconcile/lib/edtftpj.jar, file:/usr/share/java/libgcj-3.4.6.jar, file:./, core:/]
  at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
  at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
  at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
  at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
  at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
  at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0)
  at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0)
  at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
  at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
  at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
  at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
  ...2 more
  </code></pre>