Results 1 to 3 of 3
- 02-09-2012, 11:28 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 1
- Rep Power
- 0
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 --------------------------------------------------------------
- 02-10-2012, 12:23 AM #2
Re: Problem printing PDF (Only caused when using the .jar file and not netbeans GUI)
Cross posted
https://forums.oracle.com/forums/thr...ageID=10139082
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-10-2012, 09:50 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
creation for JAR file using Netbeans(a problem)
By Cosmos in forum New To JavaReplies: 11Last Post: 11-18-2011, 08:28 AM -
Printing \n to a file
By fred2028 in forum New To JavaReplies: 5Last Post: 09-15-2011, 08:41 AM -
Adding printing in Netbeans app
By aryan.838 in forum AWT / SwingReplies: 4Last Post: 03-31-2010, 03:26 AM -
Problem in importing jar file in libraries of netbeans
By dataprofiling in forum AWT / SwingReplies: 1Last Post: 03-30-2010, 11:30 AM -
Job name when printing file
By pjmorce in forum Advanced JavaReplies: 3Last Post: 12-23-2008, 01:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks