[英]Not able to create PDF using iText 7.1.9 in Java
我正在嘗試使用 Java 中的 iText 7.1.9 jar 創建 PDF 文件。 但我低於例外。 我有編譯 jars、設置類路徑和構建路徑的所有必要步驟。 請幫我解決這個問題。
java.lang.NoClassDefFoundError: com/itextpdf/kernel/pdf/PdfDocument
在線pdfdoc = new PdfDocument(new PdfReader(file));
. 我用於 Vaadin8/Maven 的 POM.xml 如下。 在屬性標簽中:
<itext.version>RELEASE</itext.version>
在依賴項中,我添加了以下條目:
<!-- https://mvnrepository.com/artifact/com.itextpdf/itext7-core -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.1.9</version>
<type>pom</type>
</dependency>
我已經使用命令行構建了所有 jars mvn deploy:deploy-file -Dfile=/barcodes-7.1.9.jar -DgroupId=com.roufid.tutorials -DartifactId=example-app -Dversion=1.0 -Dpackaging=jar -Durl =file:./maven-repository/ -DrepositoryId=maven-repository -DupdateReleaseInfo=true
這是由於存在您的代碼所依賴的類文件並且它在編譯時存在但在運行時未找到時引起的。 尋找構建時間和運行時類路徑的差異。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.