Guides for SE student projects »

Java 17 Installation Guide for Windows Users

This guide explains how to install the Oracle Java 17 JDK on Windows.

Installation

  • Download JDK

    • Go to the Oracle download site here.
    • Choose JDK 17Windows.
    • Download the x64 Installer:
  • Install JDK

    • Run the downloaded installer and follow the instructions to complete the installation.
    • Suppose the JDK was installed in the directory C:\Program Files\Java\jdk-17 (this is the default location).

  • Verify installation by running the following command in your terminal (e.g. Command Prompt, PowerShell). You should see the version information for Java 17.0.12.

     java -version
    

Switching between Java versions

If you have multiple versions of Java installed, you can switch between them by editing the system environment variables. This involves updating the "Path" settings to point to your desired JDK version.

  • To see the currently active Java version run the following command in a terminal window,
    java -version
    
  • To switch to a different installed version,
    • Open the Start Menu by clicking the Start button on your taskbar or pressing the Windows key on your keyboard.

    • Type "environment variables" in the search bar and click "Edit the system environment variables" from the search results:

    • In the window that opens, click on the "Environment Variables" button located near the bottom:

    • Scroll through the "System variables" section to find the "Path" variable, select it and click "Edit".

    • In the "Edit Environment Variable" window, you will see a list of paths. These paths represent directories your system searches to find executables like Java.

      • To prioritize a different Java version: Find the path to your desired Java installation (e.g., C:\Program Files\Java\jdk-17\bin) and move it to the top of the list.

      • To add a new Java version: Click "New" and add the path to the bin folder of the Java version you want to use (e.g., C:\Program Files\Java\jdk-11\bin).

    • Click OK to save your changes and close the windows.

  • Verify Version Change by running the following command in a new terminal window (note: if the terminal window was already open before you changed the system variables, you need to restart the terminal window for it to be able to 'see' the updated system variables):
    java -version
    
  • If you already have a JAVA_HOME system variable defined earlier, you need to update it to point to the JDK of your choice. The procedure is similar to how you changed the Path variable.

Authors: