Running Saxon 12 with Java 8?
Congrats on the release of Saxon 12.
I have a question on the use of Saxon 12 Java with Java 8: the documentation https://www.saxonica.com/documentation12/index.html#!about/installationjava/prerequisites says
To run SaxonJ you need at least a Java VM, and preferably a Java development environment. SaxonJ 12 requires at least Java SE 8 (also known as JDK 1.8). SaxonJ 12 is built and tested using Java SE 11, but should also still be usable with Java 8 or later
However, when I try to run the Saxon HE 12.0 with java 8, it tells me
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: net/sf/saxon/Transform has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
That probably just means that JDK 11 compiled Java code can't be executed with Java 8.
Or can you compile with Java 11 but ensure that the class file version is compatible with Java 8?
RE: Running Saxon 12 with Java 8? - Added by Michael Kay 11 months ago
Thanks. Our intent was to move to Java 11 as the baseline, though I was under the impression we were generating code that would run under 8 if required. We'll look into it, but we're prepared to drop support for anything earlier than Java 11 if necessary.
RE: Running Saxon 12 with Java 8? - Added by Martin Honnen 11 months ago
import java.lang.ref.Cleaner used in Configuration.java and CollectionFn.java (at least) doesn't seem to compile with JDK 8, at least not the OpenJDK.
But I guess it is time to move to a newer Java version (if only that were as easy for IKVM as it is on a normal PC system)
Please register to reply