We get the installer, run it and after it finishes, Java is installed. Let's try and open Terminal and run the
command to see what version we got:
java 19.0.2 2023-01-17 Java(TM) SE Runtime Environment (build 19.0.2+7-44) Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)
The files are all installed into a folder in your /Library folder, e.g.
so the libjvm.dylib is in that folder and we load it in our project here:
Put this before calling the JavaVMMBS constructor. You still pass version 1.4 there as this is the version of the jni API and this part of Java hasn't changed or 10 years. The later Java versions changed compiler and added framework classes, but didn't change the jni interface.
We can query java.version or os.version here:
When we run this, it shows the version 19.0.2 here for the java.version property. Please note that we had recently to update the .long() calls to .Int64Value() since Xojo deprecated the old calls. If the library isn't found and loaded, the application may fail and get killed by macOS for accessing Java.framework, which is the default way to load.
Please note that we have to check the platform used for macOS since running an example compiler for Intel with a Java library built for Apple Silicon. The application may just quit in that case or better repport an error.
We'll fix the Java.framework thing. Let us know if you have questions. The bug fixes for Java 19 on macOS comes into version 23.2.