title: NoClassDefFoundError with own .java in "unpackaged" test class
body: <p>I am trying to generate a pdf file.</p>
  
  <pre><code>import java.io.*;
  import com.itextpdf.text.Document;
  import com.itextpdf.text.DocumentException;
  import com.itextpdf.text.Paragraph;
  import com.itextpdf.text.pdf.PdfWriter;
  
  class HelloWordPDF
   {      
  
               public static void main(String []args) throws FileNotFoundException,DocumentException
              {
  
  
                            Document document=new Document();
                            PdfWriter.getInstance(document,new FileOutputStream("hello.pdf"));
                            document.open();
                            document.add(new Paragraph("Hello Pdf"));
                            document.close();
              }
      }
  </code></pre>
  
  <p>This java program is in the directory <strong>/home/Jagan/HelloWordPDF.java</strong>
  and the jar file   <strong>/home/Jagan/iText-5.0.6.jar</strong> </p>
  
  <p>It is compiled successfully <strong>$ javac -cp iText-5.0.6.jar HelloWordPDF.java</strong></p>
  
  <p>But when i tried to run  <strong>$java -cp iText-5.0.6.jar HelloWordPDF</strong> </p>
  
  <p>An exception occured like this </p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: HelloWordPDF/java
  Caused by: java.lang.ClassNotFoundException: HelloWordPDF.java
          at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
  Could not find the main class: HelloWordPDF.java. Program will exit.
  </code></pre>