JAVA Environment Variables Setup Windows 11

Azim Uddin Ahamed
2 min readSep 2, 2023

Hey There,

Setting up Java environment variables on Windows 11 involves configuring the JAVA_HOME and adding the bin directory to the PATH variable. Here's a step-by-step guide on how to do this:

source:google

1.Download and Install Java:

First, download and install the Java Development Kit (JDK) from the official Oracle website or another trusted source. Make sure to choose the version of Java that you need for your development work (e.g., Java 8, Java 11, Java 16, etc.).

2. Install Location:

During the installation, take note of the installation directory. By default, it’s usually located in C:\Program Files\Java\jdk-x.x.x.

3. Find the JDK Installation Path:

Open File Explorer and navigate to the directory where Java is installed. The folder should contain a subdirectory with the version number. For example, if you installed JDK 11, you might find a folder like jdk-11.x.x.

4. Set the JAVA_HOME Environment Variable:

Now, you need to set the JAVA_HOME environment variable to point to the JDK installation directory:

  • Right-click on the Windows icon in the taskbar and select “System.”
  • In the System window, click on “Advanced system settings” on the left sidebar.

In the System Properties window, click the “Environment Variables” button.

  • In the Environment Variables window, under the “System variables” section, click “New.”
  • For the “Variable name,” enter JAVA_HOME.
  • For the “Variable value,” enter the path to your JDK installation directory. For example, C:\Program Files\Java\jdk-x.x.x (replace x.x.x with your actual version number).
  • Click “OK” to save the variable.

5. Edit the PATH Environment Variable:

Next, you need to add the bin directory of your JDK installation to the PATH environment variable. This will allow you to run Java executables from any command prompt.

  • In the same “Environment Variables” window, find the “Path” variable under the “System variables” section and select it.
  • Click “Edit.”
  • Click “New” and then add the path to the bin directory inside your JDK installation directory. For example, C:\Program Files\Java\jdk-x.x.x\bin.
  • Click “OK” to save the changes

NOW YOU ARE ALL SET

6. Verify Your Installation:

To verify that you’ve set up the environment variables correctly, open a new Command Prompt window and run the following commands:

java -version

This should display the version of Java you’ve installed. Additionally, you can run:

echo %JAVA_HOME%

This should display the path to your Java home directory.

Now, you have successfully set up the Java environment variables on Windows 11. You can start developing and running Java applications on your system.

--

--