Thursday, June 7, 2018

Set the environment variables for Java in Windows



Set the environment variables for Java in Windows


Most of the people facing problem in setting java classpath while starting java programming. Please follow the steps to set required environment variables for java.
1

OR

 Just search env in the search bar, It will open System properties window for you.


You need to define below System variables and its path.
  • JAVA_HOME : C:\Program Files\Java\jdk1.8.0_152
  • JDK_HOME : %JAVA_HOME%
  • JRE_HOME : %JAVA_HOME%\jre
  • CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
  • PATH : your-unique-entries;%JAVA_HOME%\bin
To Verify:
i.                 Open command prompt by typing cmd in the search bar.
ii.               Type command (java –version )
Expected output:

If you were planning to upgrade/downgrade JDK, then you need to change only
Variable (JAVA_HOME) as all other environment variables are derived from the "root" environment variable JAVA_HOME.

0 comments:

Post a Comment