title: Don't understand why I'm getting the Error: Could not find or load main class from console
body: <p>I have looked over several other answers on this site trying to understand why this might be happening, but I don't understand what I'm doing wrong.</p>
  
  <p>I am trying to get started with iText, and .jar files in general. I downloaded and extracted the iText .jar files to a folder on my desktop: Desktop\Java\itext-5.4.4\"jar files here"</p>
  
  <p>I then went to the following site:</p>
  
  <p><a href="http://tutorials.jenkov.com/java-itext/getting-started.html" rel="nofollow">http://tutorials.jenkov.com/java-itext/getting-started.html</a></p>
  
  <p>and copied the code into Notepad. It looks like this:</p>
  
  <pre><code>import com.itextpdf.text.Document;
  import com.itextpdf.text.DocumentException;
  import com.itextpdf.text.Paragraph;
  import com.itextpdf.text.pdf.PdfWriter;
  
  import java.io.FileOutputStream;
  import java.io.FileNotFoundException;
  
  /**
  
   */
  public class HelloWorldExample {
  
      public static void main(String[] args) {
  
          Document document = new Document();
  
          try {
              PdfWriter.getInstance(document,
                  new FileOutputStream("HelloWorld.pdf"));
  
              document.open();
              document.add(new Paragraph("A Hello World PDF 
  
  document."));
              document.close(); // no need to close 
  
  PDFwriter?
  
          } catch (DocumentException e) {
              e.printStackTrace();
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>I saved the file on my desktop as HelloWorldExample.java</p>
  
  <p>I then went to compile my code with the following commands:</p>
  
  <p>cd c:\desktop</p>
  
  <p>javac -classpath Java\itext-5.4.4\itextpdf-5.4.4.jar HelloWorldExample.java</p>
  
  <p>This compiled successfully</p>
  
  <p>I then tried:</p>
  
  <p>java -classpath Java\itext-5.4.4\itextpdf-5.4.4.jar HelloWorldExample</p>
  
  <p>And I get the Error: Could not find or load main class HelloWorldExample error.</p>
  
  <p>I have tried many variations on this including making a folder, placing a lib folder in that folder, and creating a package, but still get the same error.</p>
  
  <p>What is happening here?</p>
  
  <p>Thanks!</p>