How to install OpenJDK 11 on Windows?

前端 未结 5 1956
礼貌的吻别
礼貌的吻别 2020-12-04 04:30

In the past, Oracle used to publish an executable installers for Windows that would:

  • Unpack files
  • Add registry keys indicating the installed version a
相关标签:
5条回答
  • 2020-12-04 05:02
    1. Extract the zip file into a folder, e.g. C:\Program Files\Java\ and it will create a jdk-11 folder (where the bin folder is a direct sub-folder). You may need Administrator privileges to extract the zip file to this location.

    2. Set a PATH:

      • Select Control Panel and then System.
      • Click Advanced and then Environment Variables.
      • Add the location of the bin folder of the JDK installation to the PATH variable in System Variables.
      • The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;"C:\Program Files\Java\jdk-11\bin"
    3. Set JAVA_HOME:

      • Under System Variables, click New.
      • Enter the variable name as JAVA_HOME.
      • Enter the variable value as the installation path of the JDK (without the bin sub-folder).
      • Click OK.
      • Click Apply Changes.
    4. Configure the JDK in your IDE (e.g. IntelliJ or Eclipse).

    You are set.

    To see if it worked, open up the Command Prompt and type java -version and see if it prints your newly installed JDK.

    If you want to uninstall - just undo the above steps.

    Note: You can also point JAVA_HOME to the folder of your JDK installations and then set the PATH variable to %JAVA_HOME%\bin. So when you want to change the JDK you change only the JAVA_HOME variable and leave PATH as it is.

    0 讨论(0)
  • 2020-12-04 05:03

    Use the Chocolatey packet manager. It's a command-line tool similar to npm. Once you have installed it, use

    choco install openjdk
    

    in an elevated command prompt to install OpenJDK.

    To update an installed version to the latest version, type

    choco upgrade openjdk
    

    Pretty simple to use and especially helpful to upgrade to the latest version. No manual fiddling with path environment variables.

    0 讨论(0)
  • 2020-12-04 05:06

    From the comment by @ZhekaKozlov: ojdkbuild has OpenJDK builds (currently 8 and 11) for Windows (zip and msi).

    0 讨论(0)
  • 2020-12-04 05:15

    AdoptOpenJDK is a new website hosted by the java community. You can find .msi installers for OpenJDK 8 through 14 there, which will perform all the things listed in the question (Unpacking, registry keys, PATH variable updating (and JAVA_HOME), uninstaller...).

    0 讨论(0)
  • 2020-12-04 05:17

    You can use Amazon Corretto. It is free to use multiplatform, production-ready distribution of the OpenJDK. It comes with long-term support that will include performance enhancements and security fixes. Check the installation instructions here.

    You can also check Zulu from Azul.

    One more thing I like to highlight here is both Amazon Corretto and Zulu are TCK Compliant. You can see the OpenJDK builds comparison here and here.

    0 讨论(0)
提交回复
热议问题