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 |
-
Download the zip bundle of OpenJDK 11 for Windows.
-
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.
-
Update the
PATH
as below:C:\> setx /m PATH "%PATH%;<YOUR_INSTALL_PATH>\bin"
NoteThe 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
. -
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)
-
The
%JAVA_HOME%
environment variable must also be set to use some developer tools.Set the
%JAVA_HOME%
environment variable asC:\> setx /m JAVA_HOME "<YOUR_INSTALL_PATH>"
NoteJAVA_HOME
will not work if thebin
directory is appended to your installation path.After restarting the command prompt, you can view your setting by typing
echo %JAVA_HOME%
. -
Open Command Prompt as an administrator.
-
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.
-
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.
-
Download the MSI-based installer for OpenJDK 11 for Windows.
-
Run the installer for OpenJDK 11 for Windows.
-
Click
Next
on the Welcome Screen -
Check
I accept the terms in the License Agreement
, then clickNext
-
Click
Next
and accept the defaults, review the optional properties below if you wish to make changes. -
Click
Install
-
Click
Yes
on, "Do you want to allow this app to make changes to your device?". -
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)
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.
-
Download the ZIP bundle of 11.0.3.
-
Extract the contents of the ZIP bundle to a directory of your choice.
NoteExtracting the contents of the zip bundle to a directory path that does not contain spaces is recommended.
-
On the command prompt, update
JAVA_HOME
environment variable as follows: -
Open Command Prompt as an administrator.
-
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.
-
Restart Command Prompt to reload the environment variables.
-
Set the value of path variable if it is not set already:
C:\> setx -m PATH "%PATH%;%JAVA_HOME%\bin";
-
Restart the command prompt to reload the environment variables.
-
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.
-
More than one JDK is already installed on the system.
-
Log in as a Windows system administrator.
-
On the command line, set the prompt to
C:/
. -
Enter
dir /b /s java.exe
to list all of the installed JDKs on the system. -
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.
-
Restart the command prompt to reload the environment variables.
-
Retrieve the value of the path variable:
echo %JAVA_HOME%
-
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.
-
Installation of OpenJDK 11 for Microsoft Windows.
-
Unarchive the zip
-
In the
missioncontrol
directory, open the JMC client executable file. -
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
-
On the JMC Client screen, create a new connection from the File Menu, choose your JVM, and start JMX console.
-
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.
-
Installed Java Runtime
-
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