Installing Java on Windows

Installing Java on Windows

To install Java on Windows, follow these steps:

Step 1: Download the JDK

Go to the Oracle JDK download page, select the latest JDK version, and download the installer suitable for your system.

Step 2: Run the installer

Once the file is downloaded, open it and follow the installation prompts. It’s usually fine to stick with the default options.

Step 3: Configure Environment Variables

After installation, you’ll need to set up environment variables so your system can locate Java.

  • Open the Start Menu, search for environment variables, and click on Edit the system environment variables.
  • In the System Properties window, click the Environment Variables… button.
  • Under System variables section, find and select the Path variable, and click Edit….
  • In the Edit environment variable window, click New and enter the path to the JDK’s bin directory (e.g., C:\Program Files\Java\jdk-<version>\bin).
  • Click OK to close the window.
  • Back in the Environment Variables window, under System variables section, click New… to add a new variable.
  • Set the variable name to JAVA_HOME and the value to the JDK folder path (e.g., C:\Program Files\Java\jdk-<version>).
  • Click OK to close all open windows.

Step 4: Verify the installation

To ensure Java was installed successfully, open a Command Prompt window and run:

java -version

If you receive an error message, the installation might not have been completed correctly.