Amazon offers an open jdk for Windows (and other OS), but just for Java 8, 11 and 16. You can download it from here: https://aws.amazon.com/es/corretto/
After installing it and running the java -version command, you will see something like this:
>java -version openjdk version "1.8.0_242" OpenJDK Runtime Environment Corretto-8.242.08.1 (build 1.8.0_242-b08) OpenJDK 64-Bit Server VM Corretto-8.242.08.1 (build 25.242-b08, mixed mode)Answer from Manuel Domínguez on Stack Overflow
Videos
Amazon offers an open jdk for Windows (and other OS), but just for Java 8, 11 and 16. You can download it from here: https://aws.amazon.com/es/corretto/
After installing it and running the java -version command, you will see something like this:
>java -version openjdk version "1.8.0_242" OpenJDK Runtime Environment Corretto-8.242.08.1 (build 1.8.0_242-b08) OpenJDK 64-Bit Server VM Corretto-8.242.08.1 (build 25.242-b08, mixed mode)
The best way to do this is to use the builds from adoptopenjdk. They're very high quality and come in multiple variants for Windows ranging from zip files to MSI installers. Dead simple to install JDK 8, 11 or 15.
But, after the installation when I tried checking the version using command java -version it's showing like regular JDK.
This is because JAVA_HOME is pointing to your old JDK. You need to go to Control Panel and change the Environment Variables. Just do a search on Windows 10 for "Environment Variables" to easily find that configuration panel.
You can extract the JDK folder from the Installation EXE.
Check this link for the steps. The post was for JDK 1.7 it will work for JDK 1.8 also
Do the following.
Steps
- Download JDK from Oracle
- Download and Install 7-zip from here
- Open installition exe using 7-Zip
- Extract the tools.zip
- Extract the content of tools.zip to a folder (e.g. c:\jdk).
- Open the extracted folder in cmd prompt.
- Execute
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"command - Set
JAVA_HOMEto the jdk (e.g c:\jdk) folder. - Add
%JAVA_HOME%/binto the PATH env variable.
Testing
Run the following command to check the installation, it will print the version of JDK.
c:> javac -version
javac 1.7.0_51
NOTE: Tested with JDK 1.7 and 1.8
Update 1
Edited the answer to add the steps in the answer itself instead of the link to a blog post.
Update 2
For 64-Bit please check unpack-jdk-x64.bat by grabantot
I was looking for a solution to this as well. I'm not sure why the OP wanted to do this. I'm just trying to get a newer version of java for new development while not interfering with an older Java install which a legacy application requires (I'd like to update the legacy app, but it's not an option, now)
I think the hack I am going to try is this:
- Install 1.8
- Take a copy of the install folder
- Uninstall 1.8
- Reinstall / Repair 1.7
- restore the copy of 1.
I'm sure if I had a better understanding of what the install is doing, this would not be necessary.