How to install Java on Windows 10

To develop Java programs you need to install the Java Development Kit (JDK). It contains the Java compiler and other tools.

The following steps will show you how to install OpenJDK on Windows 10. OpenJDK is a free and open-source implementation of Java SE (Standard Edition).

Download

  1. Go to the OpenJDK landing page.
  2. Navigate to the JDK version labeled as Ready for Use; in my case, it’s JDK 13. Click on the zip link for Windows to download the Windows JDK binaries to your computer. Unzip the files.
    open-jdk-download

Install

  1. Create a new folder in your computer called Java under C:\Program Files. Inside this folder, place the unzipped folder titled jdk-{yourVersion}.

    java-folder

Set PATH Environment Variable

This will set the PATH variable permanently, so you don’t have to type the entire path to the executables (e.g. javac.exe, java.exe) when compiling and running Java programs from the command line.

  1. On the Windows search bar, type “Environment variables”. Click on the option that comes up: Edit the system environment variables. Then click on Environment Variables.
    system-properties
  2. Under System variables, double-click on Path to edit that variable.
    system-variables-path
  3. Click New and enter the path to the jdk bin folder: C:\Program Files\Java\ jdk-{yourVersion}\bin. Click Ok to save your settings.
    edit-env-variable

Verify Installation

  1. Open the command prompt.
  2. Type java -version. You should see the launcher version on the console.
  3. Type javac -version. You should see the compiler version on the console.
    command-prompt-java-version

Leave a Comment