简体   繁体   中英

How get a Mac JRE (on linux) that is ready for embedding?

For years I have distributed a piece of software that relies on javafx, and the solution has been to include a JRE in the distributed software and run my.jar file with a script that sets JAVA_HOME. It has worked great.

The Mac version has always been a challenge: I have to download the.dmg from java, unpack it, and tweak the script for (historically) a different directory structure (which may be an artifact of the.dmg packaging, I don't know). But it always worked. (I do this on Linux.)

I recently updated the included JRE to the latest version (1.8.0_291) and it no longer works on the Mac, even after I corrected for the new directory structure. Users report that the script errors with:

Error: could not find libjava.dylib
Error: Could not find Java SE Runtime Environment.

...and indeed, there is no libjava.dylib. In the previous Mac JRE version I was using (1.8.0_92) this file was at:

lib/jre/Contents/Home/lib/libjava.dylib

...but it is not present anywhere in the latest. I also note that the latest JRE totals 107 MB, where the older one was 164 MB, so it would appear that there is something I'm not understanding about these more recent JRE downloads. Eg perhaps the mac version requires an installer to run to be complete?

Where can I download a distributable Mac JRE?

Failing that, what is the proper way to make a contained Mac JRE?

It appears that AdoptOpenJDK is a good general way to go for multi-platform pre-built JREs, but they do not include JavaFX .

I attempted to use OpenJDK in conjunction with libraries from OpenJFX from openjfx.io , and although my application superficially worked, there were very many exceptions implying poor compatibility between the two. (I was unable to match versions precisely for JDK 11. It's possible that the latest version of both (JDK 16) might interoperate better.)

I found the Liberica JDK from BellSoft . Their "Full JRE" includes javafx and is working. I do get one swing-related exception on startup, but it doesn't seem to matter to functionality.

Apparently there is also the Azul platform , but I have not investigated it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM