I trying to create some code with PHPJasper, but at same line I get error. I think it's problems with Java SE versions.
File hello_world.jasper
is already exist in my project.
Source code:
require __DIR__ . '/vendor/autoload.php';
use PHPJasper\PHPJasper;
$jasper = new PHPJasper;
$input = __DIR__ . '/vendor/geekcom/phpjasper/examples/hello_world.jasper';
$output = __DIR__ . '/vendor/geekcom/phpjasper/examples';
$options = [
'format' => ['pdf', 'rtf']
];
$jasper->process(
$input,
$output,
$options
)->execute();
var_dump($jasper);
Error in console for line with execute()
:
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at de.cenote.tools.classpath.ApplicationClasspath.add(ApplicationClasspath.java:75)
at de.cenote.tools.classpath.ApplicationClasspath.add(ApplicationClasspath.java:65)
at de.cenote.tools.classpath.ApplicationClasspath.addJars(ApplicationClasspath.java:134)
at de.cenote.tools.classpath.ApplicationClasspath.addJarsRelative(ApplicationClasspath.java:151)
at de.cenote.jasperstarter.App.processReport(App.java:178)
at de.cenote.jasperstarter.App.main(App.java:109)
PHP Fatal error: Uncaught PHPJasper\Exception\ErrorCommandExecutable: Your report has an error and couldn 't be processed!\ Try to output the command using the function `output();` and run it manually in the console. in /home/jack/PhpstormProjects/JasperTest/vendor/geekcom/phpjasper/src/PHPJasper.php:219
Java version:
java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu219.04)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu219.04, mixed mode, sharing)
How can I fix it?