I have problem with Free Spire.XLS.
I make Maven projekt, this is my pom.xml:
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>demo.com</groupId>
<artifactId>PDF_keszito</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls.free</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</project>
And this is my code:
- Code: Select all
private static void pdf()
{
try {
Workbook workbook = new Workbook();
workbook.loadFromFile(System.getProperty("user.home") + "\\Desktop\\Techem OQC\\Techem OQC_Rhsz_TE05-06-21.xlsx");
workbook.getConverterSetting().setSheetFitToPage(true);
workbook.saveToFile(System.getProperty("user.home") + "\\Desktop\\Techem OQC\\Techem OQC_Rhsz_TE05-06-21.pdf",FileFormat.PDF);
System.out.println("Lefutott");
}
catch (Exception e) {
System.out.println(e);
e.printStackTrace();
String hibauzenet = e.toString();
JOptionPane.showMessageDialog(null, hibauzenet, "Hiba üzenet", 2); //kiírja a hibaüzenetet
}
}
If I run the code i have this issue:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalAccessError: class com.spire.xls.packages.sprRFA (in unnamed module @0x5c31b8a) cannot access class sun.security.action.GetPropertyAction (in module java.base) because module java.base does not export sun.security.action to unnamed module @0x5c31b8a
at com.spire.xls.packages.sprRFA.spr (Unknown Source)
at com.spire.xls.packages.sprRFA.spr (Unknown Source)
at com.spire.xls.packages.sprRFA.<init>(Unknown Source)
at com.spire.xls.packages.sprksa.<init>(Unknown Source)
at com.spire.xls.packages.sprHTa.<init>(Unknown Source)
at com.spire.xls.core.spreadsheet.XlsWorkbook.<init>(Unknown Source)
at com.spire.xls.Workbook.<init>(Unknown Source)
at Ablak.pdf(Ablak.java:53)
at Ablak.access$0(Ablak.java:49)
at Ablak$1.run(Ablak.java:29)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
What is the problem?
The System JRE version is JDK 16.
The JRE version is in Eclipse for the project is JaveSE-1.8
Op system: Win 10 64 bit