So I've been using Jasper Reports on JDK8 (Netbeans 11.1 & JavaFX 2) and everything was simple. Now I am migrating from JDK8 to OpenJDK11 with gradle (IntelliJ IDEA & JavaFX 14) and I am stuck with Jasper Reports.
I tried to add the dependency compile 'net.sf.jasperreports:jasperreports:6.12.2'
and the jar files were downloaded successfully, but when I go to my code and try to import the necessary libraries I can't find them.
Here's the code I was using in JDK8 (which I think should be the same in OpenJDK11) :
@FXML
public void print(ActionEvent actionEvent) {
// My report
JasperReport jreport = JasperCompileManager.compileReport("path\\to\\my\\report\\newReport.jrxml");
// The data source to use to create the report
JRBeanCollectionDataSource jcs = new JRBeanCollectionDataSource(list);
JasperPrint jprint = JasperFillManager.fillReport(jreport, null, jcs);
// Viewing the report
JasperViewer.viewReport(jprint, false);
}
and here's the libraries I need (net.sf was not detected at all eventhought the jar file is downloaded):
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.view.JasperViewer;
So after some research and many new problems, I think I've found a simple solution:
implementation 'net.sf.jasperreports:jasperreports:6.12.2'
implementation 'net.sf.jasperreports:jasperreports-fonts:6.12.2'
requires jasperreports;
implementation 'com.lowagie:itext:2.1.7'
I hope it helped someone besides me!