Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA_HOME set but not taking effect

Tags:

java

enter image description here

As depicted in above image java home is set and is being echoed but when i check for version it gives me latest version. Already restarted the command prompt after setting env variable. OS is Windows 7

Update:

Following is the Path.

..ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;;%JAVA_HOME%/bin;

like image 791
Jabir Avatar asked May 04 '15 06:05

Jabir


2 Answers

I had the same trouble and I solved it with the following steps:

You need the correct environment variables.

To be exactly correct, you only need to set the Path variable.

You need to find where you add %JAVA_HOME%\bin to the path.

Put it at first place in the Path variable:

%JAVA_HOME%\bin;... 

where ... represents all other values of Path.

I assume that JAVA_HOME is defined as a variable and had the correct value.

After this reopen console and check:

java -version
like image 168
catch23 Avatar answered Nov 13 '22 16:11

catch23


JAVA_HOME is environment variable that various application reads in their launcher script

when you invoke java it looks up for all paths specified in your env variable named PATH and wherever the first match is it gets picked up

so if you like command prompt to refer to jdk 6's Java append the path to PATH

like image 26
jmj Avatar answered Nov 13 '22 17:11

jmj