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 :
- 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
- Once the File gets downloaded its basically “next” , “next” click to get the JDK installed.
- Once the JAVA JDK gets installed and if you have left the default you would be able to see at the below path
- Now you need to set up your JAVA_HOME . For this go to your “This PC” and click on Properties
- This will open up System . Go to 🡪 Advance System Settings 🡪 Environment Variables 🡪 JAVA_HOME in user & system variables as below
- 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
- 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”
- Now if you go to your command line and run java -version or javac -version from anywhere you should get as below