NewGrad
NewGrad

Reputation: 13

Environment Variables not working properly or Java not installing correctly

I'm going through a self training course for a company I just started with as a QA. The "mandatory" installs apply to everyone whether developer or QA. I'm needing to install an older version of Java JDK 1.6.x and my guide says to create a directory for all the tools they want me to install.

I had to create a dev/tools directory called devel under my username, within it I put a gitsrc directory for source code that we share and a tools directory as well. I then had to create Environment Variables (system-wide) for the tools folder. I named the tools one (where I need to dumb all of the installs) DEV_TOOLS and put the path value to C:\Users\myusername\devel\tools <----this part is correct.

I then created an additional JAVA_HOME variable with value of %DEV_TOOLS%\jdk1.6.x for the specific version. After the install I have to append the PATH variable so that the %JAVA_HOME%\bin is added in there as well.

I run into 2 issues:

1st when I try to download JDK 1.6.x and specify path as %DEV_TOOLS%\jdk 1.6.x it says unavailable, so I just used the long form C:\users\myusername\devel\tools\jdk1.6.x as mentioned before then it goes fine.

2nd after I install it I need to verify that it worked properly so I run cmd and type java -version to see if its correct. It doesn't display the newly downloaded version but an older version of jdk 1.6.x.

So what am I doing wrong? Sorry for the length of this question, but I figured better to be detailed. Any help/recommendations would be appreciated.

Upvotes: 1

Views: 1087

Answers (1)

cmd
cmd

Reputation: 11841

The system is detecting a different version of Java. Instead of Appending %DEV_TOOLS%\jdk6\bin to PATH, prepend it to PATH. Order matters.

To prepend Java without the variables, you can do the following:

PATH=C:\Path\To\Java\bin;...

In your case you want something like:

PATH=%DEV_TOOLS%\jdk6\bin;...

Of course, be sure DEV_TOOLS is defined

Upvotes: 1

Related Questions