nus-oss / AB3-J17

:ab::three: Address Book sample application (Level 3)
https://se-education.org/addressbook-level3
MIT License
0 stars 16 forks source link

[Project A][MacSilicon][gongg21] Upgrade to Java 17 #8

Closed gongg21 closed 2 months ago

gongg21 commented 2 months ago

Details

OS used: macOS Sonoma 14.4.1 with M1 Pro JDK distribution used: Azul Zulu JDK FX 17 IDE used: IntelliJ IDEA 2022.3.1 Link to uploaded JAR file

Resolving Compatibility Issues Faced

Ran into Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError ... (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')) error when switching JDKs.

There is a need to add additional lines in the build.gradle file under dependencies to resolve compatibility issues regarding the JDK. This includes the lines ending with classifier: 'mac-aarch64'. Specifically for me using an M1 Mac, they must be placed above the ones ending with classifier: 'mac', otherwise the Gradle tasks will fail.

From what I understand, Gradle will try to find the first compatible dependency during resolution. This means if the same code here were to be used on an Intel Mac, the Gradle tasks would fail as Gradle would try to resolve using the 'mac-aarch64' libraries. As this may affect/apply to students in future, I believe it is good to note.

Additional

Also updated documentation to reflect support for Java 17.

damithc commented 2 months ago

@gongg21 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?

damithc commented 2 months ago

Closing, as the migration was done in https://github.com/nus-oss/AB3-J17/commit/fe805d8553bbc329644371a6e732a8317ea6686f