How To Set JAVA Environment Variables in Windows?

Checking whether you have installed Java or not in your machine is quite easy. In your command prompt type java and press enter. If you see a list of entries (i.e. parameters for using java commands) which means java is installed. If not installed your need to download it from the official site: FREE JAVA INSTALL.

But installation only is not enough to run a java based application in your machine. Most of the time we cannot see the logs in Windows based software. But in case you are able to see the installation logs provided by that particular application you will see issues like:

Path not found for Java, JAVA_HOME not found System cannot find JRE, JDK etc…

Today in this blog I’ll be writing about setting some environment variables required for Java.

In order to set environment variables:

  • Open My Computer or This PC
  • Do Right Click and Click Properties
  • Click Change Settings
  • Switch to Advanced Tab
  • Click Environment Variables
  • Click New
    Here we add a Variable name and Value in two separate box.
    In order to add Java Variables add following Environment Variables each at a time:

Variable Name: JAVA_HOME 

Variable Value: C:\Program Files\Java\jdk1.8.0_112

Note: Enter path of respective jdk version exploring the path mentioned above.

Variable Name: JDK_HOME

Variable Value: %JAVA_HOME%

Variable Name: JRE_HOME

Variable Value:%JAVA_HOME%\jre

Variable Name: CLASSPATH

Variable Value: .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib

After you add the environment variables one more thing should be done.

  • Edit PATH
  • Add %JAVA_HOME% and save the changes.