How to get java -version start running from anywhere on the cmd line on windows by setting up the JAVA_HOME and path

If you want to install any program that is written in Java say Maven or install and run a SCALA program the first pre-requisite is that you should have the Java JDK installed .

In order to check if you have the Java JDK installed or not go to your cmd line and run java -version ( if you get the right version that means java JDK is installed and you need not do anything )

So Here in this Blog we cover “How to get java -version start running from anywhere on the cmd line on windows by setting up the JAVA_HOME and path” by following the below steps :

  1. Install the latest version of JAVA JDK from here :  Oracle JAVA JDK Download Site  . On clicking this link , Accept the License Agreement as below and download the exe for windows

  1. Once the File gets downloaded its basically “next” , “next” click to get the JDK installed.
  2. Once the JAVA JDK gets installed and if you have left the default you would be able to see at the below path

 C:\Program Files\Java

  1. Now you need to set up your JAVA_HOME . For this go to your “This PC” and click on Properties

  1. This will open up System . Go to ? Advance System Settings ? Environment Variables ? JAVA_HOME in user & system variables as below  
  2. To set up JAVA_HOME click on “New” for “User Variables” and “System Variable” and enter Variable name as JAVA_HOME and variable value as the path where your java got installed 
  1. Finally click on “path” on both user and system variable and enter as below  and click on “New” and enter “ %JAVA_HOME%\bin “ and click “ok” 
  1. Now if you go to your command line and run java -version or javac -version from anywhere you should get as below

Leave a Comment

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

Trustpilot
Scroll to Top