Only Oracle JDKs and JREs are available for Windows platforms. The installation procedure is straight-forward:
An alternate way to install Java on Windows using the command prompt is to use Chocolately:
Install Chocolately from https://chocolatey.org/
Open a cmd instance, for example hit Win+R and then type "cmd" in the "Run" window followed by an enter.
In your cmd instance, run the following command to download and install a Java 8 JDK:
C:\> choco install jdk8
Getting up and running with portable versions
There are instances where you might want to install JDK/JRE on a system with limited privileges like a VM or you might want to install and use multiple versions or architectures (x64/x86) of JDK/JRE. The steps remain same till the point you download the installer (.EXE). The steps after that are as follows (The steps are applicable for JDK/JRE 7 and above, for older versions they are slightly different in the names of folders and files):
Move the file to an appropriate location where you would want your Java binaries to reside permanently.
Install 7-Zip or its portable version if you have limited privileges.
With 7-Zip, extract the files from the Java installer EXE to the location.
Open up command prompt there by holding Shift
and Right-Click
ing in the folder in explorer or navigate to that location from anywhere.
Navigate to the newly created folder. Let's say the folder name is jdk-7u25-windows-x64
. So type cd jdk-7u25-windows-x64
. Then type the following commands in order :
cd .rsrc\JAVA_CAB10
extrac32 111
This will create a tools.zip
file in that location. Extract the tools.zip
with 7-Zip so that the files inside it are now created under tools
in the same directory.
Now execute these commands on the already opened command prompt :
cd tools
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"
Wait for the command to complete. Copy the contents of tools
to the location where you want your binaries to be.
This way, you can install any versions of JDK/JRE you need to be installed simultaneously.
Original post : http://stackoverflow.com/a/6571736/1448252