PdfWriter.getInstance problem

  • The application runs properly on my computer, but on remote server it throws error message
    The type initializer for "com.lowagie.text.pdf.PdfWriter" threw an exception.
       at com.lowagie.text.pdf.PdfWriter.getInstance(Document document, Stream os)

    • Hi,

      My problem is so similar, i have problems with the sentence :
      PdfWriter.getInstance(document, new FileOutputStream("filename.pdf"));

      I download itext-1.4.5.jar and the path its correct, but when i runs the program thrwos and exception:
      Exception in thread main
      java.lang.NoClassDefFoundError: com.lowagie.text.pdf.PdfGraphics2D
          at com.lowagie.text.pdf.PdfWriter.<init>(PdfWriter.java:844)
          at com.lowagie.text.pdf.PdfWriter.getInstance(PdfWriter.java:864)
          at proves.Images.main(Images.java:22).

      The code of my program is ridiculus:

                   try {
                     PdfWriter.getInstance(document, new FileOutputStream("filename.pdf"));
                     document.add(new Paragraph("Hi, this is your PDF file!"));

      I'm using jDeveloper. Have someone help me please?

      Thank you

      • Kazuya Ujihara
        Kazuya Ujihara

        This site is for .NET Framework. You have to post it at http://www.lowagie.com/iText/ .

        • Hi,

          I am getting the same problem. It works fine in local system, but its throwing error like

          "The type initializer for 'com.lowagie.text.pdf.PdfWriter' threw an exception."

          when i tried to run at online server.

          I am using shared hosting, so I really dont know whether J# distribution is installed or not?

          Please help me,as project deadline on head.


          • You have to install J# redistributable on the server, not on client.

    • Kazuya Ujihara
      Kazuya Ujihara

      Did you install Visual J# runtime package on the web server?