How to install Oracle JDK and JRE in seconds on Windows

The 2 software that JDA WMS requires for it to work on any system is JDK and Perl — be it Windows or RHEL (Redhat Enterprise Linux). What bothers me the most is that setting up Oracle JRE can be an issue on Windows Server if you do it with the preinstalled JRE package that comes with the JDK installer. For the oddest reasons, it would sometimes work like a charm — without issues. Whereas there are times that it would just hang, you can reboot the VM or uninstall and re-install and it would still not work. I’ve seen this pattern on both JDK 7 and JDK 8 versions mostly on Windows Servers 2016/2019 and even sometimes on Windows 10.

Installation:

Installation Options

JDK successful, moving towards JRE installation:

Installation Stuck:

Some users reporting it on:

Workaround:

What you can do is simply do a silent install instead via the command line. However, please make sure that cmd is running as an Administrator and run the installer as shown below:

JDK 11:
> c:\downloads\jdk-11.0.4_windows-x64_bin.exe /s ADDLOCAL="ToolsFeature,SourceFeature"
JDK 8:
> c:\downloads\jdk-8u202-windows-i586.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"
> c:\downloads\jdk-8u202-windows-x64.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"
JDK 7:
> c:\downloads\jdk-7u51-windows-i586.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"
> c:\downloads\jdk-7u51-windows-x64.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"
JDK 6:
> c:\downloads\jdk-6u45-windows-i586.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"
> c:\downloads\jdk-6u45-windows-x64.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"
Silent Install for JDK 11 on Windows

As soon as you hit the enter key. You will see the files under C:\Program Files\Java or C:\Program Files (x86)\Java (depending on if you’re installing a 32-bit or 64-bit version). You can then run java -version in a new session in cmd to verify if your installation was successful.

Error on java

For this, you can add environment variables via the command line (run as admin).

setx /M JAVA_HOME "C:\Program Files\Java\jdk-11.0.6"
setx /M PATH %PATH%;%JAVA_HOME%\bin
To Validate, open a new cmd window and run the following:
echo %JAVA_HOME%
echo %PATH%

Set Environment Variables:

Validate Environment variables:

Validate Environment Variables

Note: JDK 11 does not come with JRE, so if you add the “PublicjreFeature”, the installation will not work. The /s flag is for silent, if you remove that, you can see that it will give you the error that JRE is not included:

If you want to also install Perl via command line. You can use either of the following commands:

> ActivePerl-5.22.4.2205-MSWin32-x86–64int-403863.exe /q /l ./perl_install.log (non-verbose mode)> ActivePerl-5.22.4.2205-MSWin32-x86–64int-403863.exe /q /l*v ./perl_install.log (verbose mode)

If you have any other questions. You’re welcome to ask me in the comments below!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store