'How to create a mac universal binary with bundled JRE?

I am creating a JAVA desktop app for Mac computers, using jpackage to bundle the desired JRE into the app and finally shipping a .app to the customers.

With the new m1 apple arm silicon computers I do not want to create different apps for each processor architecture with the right JRE (intel & arm) but create one single universal binary app that launches the Intel JRE on Intel computers and the Arm JRE on Arm computers. I know this is possible somehow.

I tried to create two .apps and use the lipo tool from the mac command line, but this doesn't really work.

Any suggestions how to proceed?



Solution 1:[1]

I took the Zulu Intel and arm JRE (not JDK) builds and lipo'ed the binaries. You can download JRE 17 universal here:

https://www.hokuasoftware.com/jre/zulu-17-universal.zip

Tested on intel and arm macOS 11 Big Sur.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Christopher Bruno