Closed brein62 closed 2 months ago
@brein62 We faced this ARM vs Intel issue even with Java 11 but eventually we figured using the prescribed Azul JDK removed the need for adding mac-aarch64 to the Gradle file. I'm hoping we can do something similar with Java 17. Can you try the JDK version suggestion in https://github.com/nus-oss/AB3-J17/pull/6 and report findings?
@brein62 Can you post a JAR file created on Linux, without the mac-aarch64
in the build.gradle?
@damithc Here is the link to the release containing the three JARs created on Linux using the 17.0.11-oracle
, 17.0.11.fx-zulu
and 17.0.11.fx-librca
JDKs after removing the mac-aarch64
portion in build.gradle: https://github.com/brein62/AB3-J17/releases/tag/linux-testing
I did some tests on my M1 MacBook Air and all three JARs run on my MacBook when running the 17.0.11.fx-zulu
and 17.0.11.fx-librca
Java versions, but none of the JARs work for 17.0.11-oracle
(as expected).
Tested on Mac Silicon with JDK-FX 17.0.11.fx-zulu, and working.
java -jar Ubuntu24.04LTS-brein62.jar
and java -jar MacSilicon-brein62.jar
Everything is functioning as expected.
MacSilicon-brein62.jar
:
Ubuntu24.04LTS-brein62.jar
:
Tested on Mac Silicon with JDK-FX 17.0.11.fx-zulu, and working.
Steps and results are identical to above.
Tested on Windows 11, and working.
Steps followed:
Smoke-Tested on Windows 11, using Oracle OpenJDK version 17.0.10 on Windows Powershell Terminal running the java -jar Ubuntu24.04LTS-brein62.jar
command, basic commands were run to ensure full functionality of the application.
Tested on Mac Silicon with JDK-FX 17.0.11.fx-zulu, and working.
Steps followed: Downloaded the JAR file from the PR. Switched to JDK-FX 17.0.11.fx-zulu Ran the JAR file using java -jar Ubuntu24.04LTS-brein62.jar Performed a smoke test to verify basic functionality. Results: Everything is functioning as expected.
Screenshots:
Tested on Ubuntu 22.04.4 LTS with zulu jdk 17.0.11. JARs are working fine.
Steps followed:
Downloaded the JAR file(s) from the release.
Ran the JAR file(s) using java -jar MacSilicon-brein62.jar
, Ubuntu24.04LTS-brein62.jar
and java -jar win10-brein62.jar
.
Performed a smoke test to check basic functionality.
Results: Everything is functioning as expected.
Tested on MacSilicon with JDK-FX 17.0.11.fx-zulu, and working fine.
Switched using SDKMAN, ensure it is 17.0.11.fx-zulu, note the .fx
suffix.
Add/Delete command tested, works.
Help command tested, works.
Ran JAR file using java -jar <filename>
.
Using Ubuntu24.04LTS-brein62.jar
(i.e. inclusive of mac-aarch64
lines in build.gradle):
Using addressbook-linux-zulu.jar
:
Tested on Mac (Silicon) using JDK-FX 17.0.11.fx-zulu and working.
Downloaded the JAR release, ran the jar file using java -jar Ubuntu24.04LTS-brein62.jar Performed smoke test to check functionality.
Tested on Linux (Ubuntu 22.04) using OpenJDK 17.0.11. Working.
Steps taken:
java -jar Ubuntu24.04LTS-brein62.jar
Tested all 3 jar files on Windows 11 and working.
Steps I followed:
java -jar Ubuntu24.04LTS-brein62.jar
.java -jar MacSilicon-brein62.jar
.java -jar win10-brein62.jar
.Closing, as the migration was done in https://github.com/nus-oss/AB3-J17/commit/fe805d8553bbc329644371a6e732a8317ea6686f
Migrate AB3 to Java 17
Description
This PR migrates the AddressBook-Level3 (AB3) application to Java 17. Due to compatibility issues facing Apple Silicon (M1 Mac and above) devices when importing the JavaFX dependency, this PR adds support for Apple Silicon while also ensuring cross-platform compatibility with other operating systems (Windows 10 and Linux/Ubuntu 24.04 LTS).
Additionally, the JavaFX version is updated to the latest version of JavaFX 17 (JavaFX 17.0.11).
Devices Used
M1 MacBook Air 2020
Windows 10 PC
Linux VM running on top of Windows 10 PC
Links to all JAR files created: https://github.com/brein62/AB3-J17/releases/tag/milestone-1
Process and Approaches
org.openjfx.javafxplugin
) which seemed to download the correct JavaFX version on my Mac (the correctaarch64
version). However, I observed that the plugin only downloads the version for the OS and architecture used to build the JAR file. As a result, the JAR file created was not portable and my Windows build could not run on my Mac.mac-aarch64
JavaFX version manually. This seems to work for cross-platform (at least across operating systems) as the JAR would take the current operating system's JavaFX runtime.Possible Compatibility Issues?
Possible lack of support for Macs with Intel chip without multiple releases
I encountered an issue where the order of the dependency imports matter when running on my M1 Mac:
Swapping the imports of
mac
to be abovemac-aarch64
causes JARs created by other OSes to not work on my M1 Mac since the JAR somehow uses the Intel Mac version of JavaFX instead resulting in an error. As a result, there may be an issue with this running on Intel Macs, which needs to be tested.A Reddit thread from 2 years old seemed to suggest that only one architecture per OS is supported for JavaFX applications due to how JavaFX handles OS-native files internally (and thus likely Intel Macs would not work). If this is the case, it is likely that future applications would require two separate JAR releases (one for Windows/Mac/Linux x64 and one for Apple Silicon).