Installing a Java JDK or JRE on Windows

suggest change

Only Oracle JDKs and JREs are available for Windows platforms. The installation procedure is straight-forward:

  1. Visit the Oracle Java Downloads page:
  2. Click on either the JDK button, the JRE button or the Server JRE button. Note that to develop using Java you need JDK. To know the difference between JDK and JRE, see here
  3. Scroll down to the version you want to download. (Generally speaking, the most recent one is recommended.)
  4. Select the “Accept License Agreement” radio button.
  5. Download the Windows x86 (32 bit) or Windows x64 (64 bit) installer.
  6. Run the installer … in the normal way for your version of Windows.

An alternate way to install Java on Windows using the command prompt is to use Chocolately:

  1. Install Chocolately from https://chocolatey.org/
  2. Open a cmd instance, for example hit Win+R and then type “cmd” in the “Run” window followed by an enter.
  3. 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):

  1. Move the file to an appropriate location where you would want your Java binaries to reside permanently.
  2. Install 7-Zip or its portable version if you have limited privileges.
  3. With 7-Zip, extract the files from the Java installer EXE to the location.
  4. Open up command prompt there by holding Shift and Right-Clicking in the folder in explorer or navigate to that location from anywhere.
  5. 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`
  1. 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.
  2. 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"`
  1. 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Installing Java Standard Edition:
* Installing a Java JDK or JRE on Windows

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
97 Installing Java Standard Edition
98 Process
106 Modules
114 Applets
122 JNDI
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap