Results 1 to 3 of 3
  1. #1
    siva_vs_siva is offline Member
    Join Date
    Aug 2010
    Posts
    31
    Rep Power
    0

    Default PDF File creation Error

    i am using jtext-5.0.5.jar API

    My code is

    Java Code:
    import com.itextpdf.text.Document;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfWriter;
    
    
    FileOutputStream dout=new FileOutputStream(new File("hai.pdf"));
                  Document document=new Document();
                   PdfWriter.getInstance(document, dout);
                        document.open();
                                      document.add(new Paragraph("Hai to all"));
                  
                 document.close();
    my Error is

    java.lang.NoClassDefFoundError: com/itextpdf/text/Element
    Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.Element
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)

    WHAT IS MY MISTAKE
    Last edited by Eranga; 12-24-2010 at 01:41 AM. Reason: code tags added

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    itext-5.0.5.jar is not on classpath

    e.g. javac -classpath ../lib/itext-5.0.5.jar *.java

    in your source directory

    where ever the itext jar is at.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    If you are working with an IDE them from the IDE you can add those external file into class path.

    Or else you've to do it manually.

    By the way, please use code tags next time when you are posting again. Unformated codes are really hard to read.

Similar Threads

  1. Replies: 0
    Last Post: 11-26-2010, 11:10 PM
  2. JAR file creation
    By Cluster Storm in forum AWT / Swing
    Replies: 4
    Last Post: 06-10-2010, 04:38 AM
  3. Jar file creation
    By raghu9198 in forum New To Java
    Replies: 4
    Last Post: 01-11-2009, 04:40 AM
  4. Executable Jar File Creation
    By Doctor Cactus in forum New To Java
    Replies: 7
    Last Post: 11-13-2008, 04:31 AM
  5. How to print the creation date of a jar file
    By lunarbof in forum Advanced Java
    Replies: 9
    Last Post: 08-22-2008, 07:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •