Java_Home and Path Are Set But Java -Version Still Shows the Old One

Why is it required to mention JAVA_HOME path in double quotes when setting environment variable in windows

Because "Program Files" contains a space. And I believe you mean

set "JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07"

But Java 1.6.0 is unsupported (since February 2013), you should upgrade. Java 7 is EOL in April 2015, so I think it might be best to consider Java 8.

windows batch: if exist -- path exists but it says no -- why?

Raymond Chen once said :

The batch language was not designed; it evolved.

Which makes it full of quirks. One of them is that it is picky about parenthesis.

The following code works on my machine :

@echo off

if not exist "%JAVA_HOME%" (
echo JAVA_HOME '%JAVA_HOME%' path doesn't exist
) else (
echo Setting JAVA property to '%JAVA_HOME%\bin\java'
set JAVA=%JAVA_HOME%\bin\java
)

I used ) else (, a single parenthesis on a line by itself, and removed the parethesis from the echo statement.

You might also want to check the double quotes. Puttint the variable name inside the quotes like you did will remove the quotes from value. Here is an example :

C:\>set "test=foo bar"

C:\>echo %test%
foo bar

C:\>echo "%test%"
"foo bar"

If you need quotes in the variable's value then put them on the right hand side, like this :

C:\>set test="foo bar"

C:\>echo %test%
"foo bar"

Starting from scratch, going for former gives you more flexibilty (see @foxidrive comment), but it all depends on what you have to work with.

eclipse -vm %JAVA_HOME% in eclipse.ini fails

You cannot use environment variables in the eclipse.ini (Eclipse bug 102239), you must specify the actual full path.

You must also put -vm and the path on separate lines.

If there is a -vmargs entry in the eclipse.ini the -vm must come before that.

cordova is not using correct JAVA_Home location?

For anyone who has the same problem I change my PATH to

C:\Program Files\nodejs;
C:\Mobile\Android\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\tools; C:\Mobile\apache-ant-1.9.3-bin\apache-ant-1.9.3\bin;

%JAVA_HOME%\bin; %ANT_HOME%\bin

and this solved the problem

Facing javapath error while executing appium script

JAVA_HOME should be C:\Program Files\Java\jdk1.8.0_131, without the bin part. Note that your program is trying to run C:\Program Files\Java\jdk1.8.0_131\bin\bin\java.exe - the bin\bin is wrong.

SonarQube, TFS 2015 Vnext build -ERROR: JAVA_HOME exists but does not point to a valid Java home Folder. No \bin\java.exe file can be found there

Check your JAVA_HOME path, and make sure it points to the java root folder, in your case to C:\Program Files (x86)\Java\1.8.0_112 or C:\Program Files\Java\1.8.0_112.

Also, check this case to see whether you have the semicolon in the path.



Related Topics



Leave a reply



Submit