title: NoClassDefFoundError: com/itextpdf/text/DocumentException when exporting jasper to pdf
body: <p>I created a <code>jasper</code> report and now I need to export that report to <code>pdf</code> format. This is my code for that.</p>
  
  <pre><code>        // compiles jrxml
          JasperCompileManager.compileReportToFile(reportName + ".jrxml");
          // fills compiled report with parameters and a connection
          JasperPrint print = JasperFillManager.fillReport(reportName + ".jasper", parameters, connection);
  
          // to view the report
          //JasperViewer.viewReport(print, false);
  
          // export repor to pdf
          JasperExportManager.exportReportToPdfFile(print, "fromXml.pdf");
  </code></pre>
  
  <p>When I view the report using <code>JasperViewer</code>, it works fine. But When I exporting the report into <code>pdf</code> format, it gives me the following exception.</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException
  </code></pre>
  
  <p>But I have put the iText jar into my libraries.</p>
  
  <p><img src="https://i.stack.imgur.com/PjgQt.png" alt="enter image description here"></p>
  
  <p>But one thing, I had another version of <code>iText</code> jar before. It gave me the same exception. I thought that there may be some issues with the version of it.(I followed a tutorial, so I added the same jar as they had used in the tutorial replacing the new jar I had used).</p>
  
  <p>but still the problem remains. I thought <a href="https://stackoverflow.com/questions/14138623/java-lang-noclassdeffounderror-com-itextpdf-text-documentexception">this</a> may be the issue now(the accepted answer of the question). But I do not know how to fix it. I removed the entire library and added it again with <code>iText</code> jar which had been used by the tutorial. But I had no luck.</p>
  
  <p>Could you please help me to overcome this issue. 
  Thank you!</p>