Guides for SE student projects »

Java 17 Installation Guide for Mac Users

This guide explains how to install the Java 17 JDK+FX Azul distribution on macOS using SDKMAN.

Why this specific version of JDK?

  • This version comes with (which is not included in most ).
  • This version is resilient to when creating/running Java GUI applications built using JavaFX.

Why SDKMAN? SDKMAN simplifies the process of installing, switching between, and managing multiple versions of on Unix-based systems.

Installation

  • Install SDKMAN if you don't have it already.

    • Open Terminal and run the following command.
      curl -s "https://get.sdkman.io" | bash
      
    • Follow the instructions on the screen to complete the installation.
    • Restart your terminal or run:
      source "$HOME/.sdkman/bin/sdkman-init.sh"
      
    • To verify the installation, run:
      sdk version
      
  • Install JDK using SDKMAN

    • Install the Java 17 JDK FX version (codename Zulu) by running:
      sdk install java 17.0.11.fx-zulu
      
    • This version should be automatically set as the default, but if it is not, set it as the default by running:
      sdk default java 17.0.11.fx-zulu
      

    If your installation terminated prematurely (e.g., due to a network connectivity issue), it can result in an incomplete installation that will get in the way of future re-installations (i.e., sdk install command will give the error HTTP server doesn't seem to support byte ranges. Cannot resume.).
    Remedy: Run the sdk flush command to purge the previous incomplete installation.

  • Verify installation by running the following command. You should see the version information for Java 17.0.11.fx-zulu.

    java -version
    

If you encountered issues while following the above instructions, you can also watch the video below for a more visual explanation (note that the JDK version it uses is not the one we want -- so, adapt accordingly).

video: using SDKMAN to install multiple Java versions


Switching between Java versions

If you have multiple versions of Java installed, you can switch between them using SDKMAN.

  • To see the currently active Java version run,
    sdk current java
    
  • To switch to a different installed version, run the following command first.
    sdk use java
    
    Then press the Tab key to see the available versions installed on your computer. Keep pressing the same key until you select the desired version, and hit Enter.

  • If you don't have the desired version installed, you can install it by running the following command (as before):
    sdk install java <version>
    
  • To set a different version as the default, use the following command (as before):
    sdk default java <version>
    

Authors: