OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE).

OpenJDK 11 for Windows provides a distribution of OpenJDK that follows the Red Hat Enterprise Linux distribution of OpenJDK as closely as possible on the Microsoft Windows platform. Windows builds use Red Hat Enterprise Linux RPM sources and apply all of the relevant RPM patches.

OpenJDK 11 for Windows includes OpenJDK, fonts, timezone data, and CA certificates from Red Hat Enterprise Linux.

1. Installing OpenJDK on Windows

1.1. Installing OpenJDK using the zip bundle

The easiest way to install the JDK on Windows is to unarchive the zip via the command prompt.

Note

Extracting the contents of the zip bundle to a directory path that does not contain spaces is recommended.

This is important as many scripts that reference the JAVA_HOME environment variable may not extract the path correctly if their is a space present.

Procedure
  1. Download the zip bundle of OpenJDK 11 for Windows.

  2. Extract the contents of the zip bundle to a directory of your choice. See the note and caution above about spaces in the install path.

  3. Update the PATH as below:

    C:\> setx /m PATH "%PATH%;<YOUR_INSTALL_PATH>\bin"
    Note

    The above command only works if you start the command prompt with Run as administrator.

    /m updates the value as a system wide setting, instead of the default local environment.

    You have to restart the command prompt to check the setting by typing path.

  4. Verify the OpenJDK 11 for Windows is installed by running: java -version in a newly opened command prompt and you should see the following:

    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
    or
    openjdk version "1.8.0_212-2-redhat"
    OpenJDK Runtime Environment (build 1.8.0_212-2-redhat-b04)
    OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
    or
    openjdk version "11.0.3-redhat" 2019-04-16 LTS
    OpenJDK Runtime Environment 18.9 (build 11.0.3-redhat+7-LTS)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.3-redhat+7-LTS, mixed mode)
  5. The %JAVA_HOME% environment variable must also be set to use some developer tools.

    Set the %JAVA_HOME% environment variable as

    C:\> setx /m JAVA_HOME "<YOUR_INSTALL_PATH>"
    Note

    JAVA_HOME will not work if the bin directory is appended to your installation path.

    After restarting the command prompt, you can view your setting by typing echo %JAVA_HOME%.

  6. Open Command Prompt as an administrator.

  7. Set the value of the environment variable to your OpenJDK installation path:

    C:\> setx /m JAVA_HOME "C:\Progra~1\RedHat\java-11-openjdk-11.0.1.13-1"

    If the path contains spaces, use the shortened path name.

  8. Restart Command Prompt to reload the environment variables.

1.2. Installing OpenJDK with the MSI Installer

The simplest way to install OpenJDK on Microsoft Windows.

Procedure
  1. Download the MSI-based installer for OpenJDK 11 for Windows.

  2. Run the installer for OpenJDK 11 for Windows.

  3. Click Next on the Welcome Screen

  4. Check I accept the terms in the License Agreement, then click Next

  5. Click Next and accept the defaults, review the optional properties below if you wish to make changes.

  6. Click Install

  7. Click Yes on, "Do you want to allow this app to make changes to your device?".

  8. Verify the OpenJDK 11 for Windows is installed by running: java -version in a newly opened Command Prompt and you should see the following:

    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
    or
    openjdk version "1.8.0_212-2-redhat"
    OpenJDK Runtime Environment (build 1.8.0_212-2-redhat-b04)
    OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
    or
    openjdk version "11.0.3-redhat" 2019-04-16 LTS
    OpenJDK Runtime Environment 18.9 (build 11.0.3-redhat+7-LTS)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.3-redhat+7-LTS, mixed mode)
(Optional)

Select the desired extra environment settings if needed as described below

The OpenJDK 11 for Windows MSI-based installer includes the following components and sets the following properties:

Components

JDK Files

Java Development Kit (JDK) OpenJDK 11 for Windows files.

Properties

Setting Default JDK 8 JDK 11 Description

OpenJDK Runtime - Windows Registry

Yes

Yes

Yes

The following registry keys are set HKLM\Software\JavaSoft\JDK\<version>, entries: JavaHome: <INSTALLDIR> RuntimeLib: <INSTALLDIR>\bin\server\jvm.dll

HKLM\Software\JavaSoft\JDK, entries: CurrentVersion: <version>

OpenJDK Runtime - Path Variable

Yes

Yes

Yes

Adds the Runtime to the Path variable so it is available from the command line.

OpenJDK Runtime - JAVA_HOME System Variable

No

Yes

Yes

JAVA_HOME is used by some programs to find the Java runtime.

OpenJDK Runtime - REDHAT_JAVA_HOME System Variable

No

Yes

Yes

REDHAT_JAVA_HOME will be used in the future for Mission Control.

OpenJDK Runtime - Jar Files Association

No

Yes

Yes

This enables Jar files to be run from within Windows Explorer.

Web Start (Beta) - JNLP File Association

No

Yes

No

Enables the launching of JNLP files downloaded from the web.

Web Start (Beta) - PATH Variable

No

Yes

No

Enables the launching of JNLP files downloaded from the web from the local file system.

Web Start (Beta) - Keep Settings and Cache

No

Yes

No

Keeps settings and caches on the local file system.

Mission Control - Path Variable

No

No

Yes

Adds Mission Control to the Path Variable so it is available from the command line.

2. Updating OpenJDK on Windows

2.1. Updating OpenJDK for Microsoft Windows using the zip bundle

OpenJDK 11 for Windows can be manually update using the zip bundle.

Procedure
  1. Download the ZIP bundle of 11.0.3.

  2. Extract the contents of the ZIP bundle to a directory of your choice.

    Note

    Extracting the contents of the zip bundle to a directory path that does not contain spaces is recommended.

  3. On the command prompt, update JAVA_HOME environment variable as follows:

  4. Open Command Prompt as an administrator.

  5. Set the value of the environment variable to your OpenJDK installation path:

    C:\> setx /m JAVA_HOME "C:\Progra~1\RedHat\java-11-openjdk-11.0.1.13-1"

    If the path contains spaces, use the shortened path name.

  6. Restart Command Prompt to reload the environment variables.

  7. Set the value of path variable if it is not set already:

    C:\> setx -m PATH "%PATH%;%JAVA_HOME%\bin";
  8. Restart the command prompt to reload the environment variables.

  9. Verify that java -version works without supplying the full path.

    C:\> java -version
    openjdk version "11.0.3" 2019-04-16 LTS
    OpenJDK Runtime Environment (build 11.0.3+7-LTS)
    OpenJDK 64-bit Server VM (build 11.0.3+7-LTS, mixed mode)

3. Configuring OpenJDK for Windows

3.1. Selecting a specific JDK from the installed versions for an application

You can select a specific JDK from the installed versions on Microsoft Windows for an application.

Prerequisites
  • More than one JDK is already installed on the system.

Procedure
  1. Log in as a Windows system administrator.

  2. On the command line, set the prompt to C:/.

  3. Enter dir /b /s java.exe to list all of the installed JDKs on the system.

  4. Set the value of the environment variable to your JDK (or JRE) installation path:

    setx -m JAVA_HOME "Path to Java"

    If the path contains spaces, use the shortened path name.

  5. Restart the command prompt to reload the environment variables.

  6. Retrieve the value of the path variable:

    echo %JAVA_HOME%
  7. Set the value of path variable:

    setx -m PATH "%PATH%;%JAVA_HOME%\bin";

3.2. Setting up JDK Mission Control for Windows

This procedure describes how to install and set up JDK Mission Control for Microsoft Windows.

Prerequisites
  • Installation of OpenJDK 11 for Microsoft Windows.

Procedure
  1. Unarchive the zip

  2. In the missioncontrol directory, open the JMC client executable file.

    OpenJDK entities
  3. On the command line, start the JMC Client by entering jmc or the the full path to the JMC executable.

    JAVA_HOME\missioncontrol\jmc.exe
  4. On the JMC Client screen, create a new connection from the File Menu, choose your JVM, and start JMX console.

  5. The result should give you an overview page with Processors, Memory consumption, Java heap use, JVM CPU usage, etc.

3.3. Configuring OpenJDK to run with customized heap size

OpenJDK 11 for Windows can be configured to use a customized heap size.

Prequisites
  • Installed Java Runtime

Procedure
  1. Run the application by adding maximum heap size option to your java command line. For example to set the maximum heap size to 100 megabytes use the -Xmx100m option.

    $ java -Xmx100m <your-main-class>

Revised on 2019-06-04 11:00:20 EDT