Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Java (JDK) on Windows

Download the Java Development Kit, install it and check the version.

Windows Hosting2 min read4 steps6 screenshots

Why Java on Windows

Java runs a huge number of programs and servers, such as Tomcat, Jenkins and Minecraft-like tools. To develop in Java, or to run many server apps, you need a JDK (Java Development Kit).

Step 1: Download the JDK

Open the Oracle website (or use a free OpenJDK build such as Eclipse Temurin) and download the Windows x64 Installer of the JDK version you need. Long-term support versions such as 17 and 21 are good choices.

The JDK download page

Step 2: Run the installer

Open the downloaded .exe (or .msi) file.

The JDK installer

Click Next.

The installation process

Step 3: Choose the install location

The default folder is fine, for example C:\Program Files\Java\jdk-21.

Step 4: Install

Click Install, wait, and click Close.

Installing the JDK
The JDK is installed

Step 5: Check Java

Open a new Command Prompt:

java -version
javac -version
The Java version

If you see the version, Java works.

Set JAVA_HOME and the PATH (if needed)

Some installers set the PATH by themselves. If java is not found:

  1. Search for environment variables and open Edit the system environment variables. Click Environment Variables.
  2. Click New under System variables. Name it JAVA_HOME and give the JDK folder as the value, for example C:\Program Files\Java\jdk-21.
  3. Select Path, click Edit, click New and add %JAVA_HOME%\bin.
  4. Click OK in all windows and open a new Command Prompt.

A first program

Create Hello.java:

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, Java!");
    }
}

Compile and run:

javac Hello.java
java Hello

Quick recap

  • Download and run the JDK installer.
  • Check with java -version.
  • Set JAVA_HOME and the PATH if the command is not found.