Results 1 to 3 of 3
  1. #1
    hanjel18 is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default Problem printing PDF (Only caused when using the .jar file and not netbeans GUI)

    Hi Guys.

    Here is the thing. I have sample code on a java class (see it below), so I can perfectly create and display the PDF file on screen when I run the project from netbeans 6.9 ... however, when I create the .jar file for the project and try to execute it, then I get an Error message saying that an exception has happened (this is not handled, despite the existing try catch)... Could you please try it yourselve and/or help me out with this...

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.util.Date;
    import com.lowagie.text.Document;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.pdf.PdfWriter;
    import javax.swing.JOptionPane;

    public class GeneratingPDF_V2 {

    public static void main(String[] args) {
    try {
    OutputStream file = new FileOutputStream(new File("C:\\GD\\Test.pdf"));

    Document document = new Document();
    PdfWriter.getInstance(document, file);
    document.open();
    document.add(new Paragraph("Blabla"));
    document.add(new Paragraph(new Date().toString()));

    document.close();
    file.close();

    } catch (Exception e) {

    JOptionPane.showMessageDialog(null,e.getMessage()) ;
    }
    }

    }//END OF GeneratingPDF_V2 --------------------------------------------------------------

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default Re: Problem printing PDF (Only caused when using the .jar file and not netbeans GUI)

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,183
    Rep Power
    20

    Default Re: Problem printing PDF (Only caused when using the .jar file and not netbeans GUI)

    As EJP says over there, what is the exception?
    Full stack trace and identify the line in your code it occurs on.

Similar Threads

  1. creation for JAR file using Netbeans(a problem)
    By Cosmos in forum New To Java
    Replies: 11
    Last Post: 11-18-2011, 09:28 AM
  2. Printing \n to a file
    By fred2028 in forum New To Java
    Replies: 5
    Last Post: 09-15-2011, 09:41 AM
  3. Adding printing in Netbeans app
    By aryan.838 in forum AWT / Swing
    Replies: 4
    Last Post: 03-31-2010, 04:26 AM
  4. Problem in importing jar file in libraries of netbeans
    By dataprofiling in forum AWT / Swing
    Replies: 1
    Last Post: 03-30-2010, 12:30 PM
  5. Job name when printing file
    By pjmorce in forum Advanced Java
    Replies: 3
    Last Post: 12-23-2008, 02:55 AM

Posting Permissions

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