nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

💎Level-10 JavaFX Setup for Apple Silicon Mac Users #87

Open SeeuSim opened 1 year ago

SeeuSim commented 1 year ago

Hi all,

Was attempting to set-up the Gradle packages for Level-10, when I ran into some issues when I followed the module website's guide.

After installing the dependencies as per the above, I faced this error when running the build package:

Error initializing QuantumRenderer: no suitable pipeline found

As it turns out, JavaFX 11 has no official support for Apple Silicon architecture (as per this link) Here are 2 fixes:

Recommended Fix

I've attempted to use the JDK 11 supplied by Azul, and it has solved the issue. You may use the guide above ^, and download the JDK from here and use it in IntelliJ. Azul bundles a JavaFX 11 version with its JDK, hence it should not have too many issues.

For reference, I previously used the JDK 11 supplied by Amazon Coretto 😭.

JavaFX 17 Fix

I'm not sure if JavaFX 17 is allowed to be used in this module, but if it is, you may use this guide. I've tried to upgrade to the next LTS version of JavaFX, JavaFX 17, and it has solved the issue.

Here's how I reconfigured build.gradle to install the dependencies instead: (You may add these lines to your build.gradle)

plugins {
    ..
    id 'org.openjfx.javafxplugin' version '0.0.11'
}

javafx {
    version = "17.0.2"
    modules = [ 'javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.graphics' ]
}

You may also reference this StackOverflow issue if you have other issues pertaining to this.

Hope this helps!

damithc commented 1 year ago

Thanks for sharing this @SeeuSim

Yes, using the exact JDK version given in https://nus-cs2103-ay2223s2.github.io/website/admin/programmingLanguages.html is the recommended fix.

wxxedu commented 1 year ago

Thanks so much for this. I managed to fix this issue on my mac, but I didn't really know what happened. Reading your post has made it very clear for me.

JamesLiuZX commented 1 year ago

Thanks for the help @SeeuSim. I used JavaFX 11 instead of 17 and it works too! If anyone else is facing difficulty with this problem, this line from the textbook fixed it for me. Set the JAVA_HOME/JDK_HOME system variables to point to /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home Since our devices come pre-installed with a Java version that is not 11, for the program to work we have to make sure we either uninstall it cleanly (from personal experience is hard), or point the JDK towards the downloaded Azul version.

Cheers and thanks Seeu Sim for the solution!