Set-java-environment-variable-path-in-windows First, check whether the path is set or not.

Open the cmd window (windows Command prompt). (Click Start – type ‘cmd’ in the search box)

Type javac and hit Enter.

If your java path is not set, you will get the following error: ” ‘javac’ is not recognized as an internal or external command, operable program or batch file“.

Otherwise, you will get a long description of the command.

Anyway, most of you guys don’t have java environment variable set, that’s why you are here. To set the path just follow the simple steps.

Before proceeding, you need to have JDK installed in your system. Please click HERE to download JDK.

Step 1:  Right-click on ‘My Computer’ and select properties.

Step 2: Go to ‘Advanced system settings’ from the right pane of the system window.

Set java environment variable path in windows

Step 3: The ‘System Properties’ window will open. Go to ‘Advanced‘ tab and click on ‘Environment Variables..‘.


Step 4: Now we have to add JDK home path under ‘User variables’ and JDK bin path in the section ‘System Variables‘.

Note: Your JDK installation directory may be different.  If you don’t know where JDK is installed, Open cmd and copy and paste the below code and hit Enter.

Set java environment variable path in windows

Set JDK home path:

Click New –

Enter the Variable name as JAVA_HOME and Enter the Variable value as the installation path of the JDK (Java Development Kit).

Variable name  : JAVA_HOME
Variable value : C:Program FilesJavajdk1.8.0_40

Set java environment variable path in windows java-environment-variable

Set JDK bin path:

Check carefully if  there is already any path variable. If there is any, you have to edit the value. Put a semi-colon (;) in front of the existing directory path variable and type the below path ( Your JDK bin directory path). The semicolon separates two directory paths.

If there isn’t any PATH variable, just add a new name and value by clicking on New.

Variable name  : PATH
Variable value : C:Program FilesJavajdk1.8.0_40bin;[existing entries…]

Set java environment variable path in windows

Set java environment variable path in windows (2)

Step 5: Click Ok after adding the Variable name and Variable value.

Step 6: Open the command prompt again, type ‘javac‘ command and hit Enter.

java-environment-variable That’s all you need to run java code from cmd.
Set Java environment variable ( ‘javac’ is not recognized as an internal or external command )
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *