Java Language Installing Java (Standard Edition) Installing a Java JDK or JRE on Windows

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

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"

  3. 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



Got any Java Language Question?