Friday, April 2, 2010

Setting JAVA HOME through Command Line in Windows

Hi all,
If you are working on some old windows machines and want to set JAVA_HOME and PATH environment variables follow the steps.

Start --> Run-->CMD .. In the command prompt first type


echo %JAVA_HOME% , if the JAVA_HOME variable is already set the path will be printed.
eg: c:/Program Files/java1.6

else %JAVA_HOME% will be printed.

You can set JAVA_HOME by typing

SET JAVA_HOME = c:/Program Files/Java (The path where your JRE or JDK is installed)

Then you can set the bin path by typing

SET PATH = %PATH%;%JAVA_HOME%\bin what you are doing here is appending the existing set PATH's with JAVA_HOME/bin.

You can also directly set the path to the JAVA Bin directory instead of the above steps like
SET PATH = %PATH%;c:/Program Files/JAVA/bin

Then if you want to view the set path you can type echo %PATH% ..

3 comments:

venkat shanthi said...




Good One and very useful. Thanks to the author. It resolved my problem. Here is is related article for more reference, please check it out

http://www.wikitechy.com/view-article/windows-path-and-other-environment-variables-in-windows

Both are really good.
Cheers,
Venkat

wcdeich4 said...

To make it take effect globally, not just in the local command window session, you need to use setx -m. Example: C:\>setx -m JAVA_HOME "C:\Program Files\Java\jdk1.8.0_151"

zaanannimzack said...

Hotels near Harrah's Hotel & Casino - Mapyro
Hotels 포항 출장마사지 1 창원 출장마사지 - 12 of 67 — Hotels 1 - 12 of 67 Near Harrah's Casino in Maricopa AZ near 당진 출장안마 Casino City 김해 출장마사지 Center are currently open. Find your next 영주 출장샵 hotel visit today!