aspose file tools*
The moose likes Java in General and the fly likes Installing and using a different jdk on Windows 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Installing and using a different jdk on Windows 7" Watch "Installing and using a different jdk on Windows 7" New topic
Author

Installing and using a different jdk on Windows 7

Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 162

Hi,

this is quite a trivial task it seems but I have downloaded jdk1.5 (I need it to build an old version of Tomcat) and set up all my env variables to point to its location, etc but Windows 7 is still picking up jdk1.6, which is what I use normally. I have deleted every reference to 1.6 in the env variables and set them to the 1.5 but when I use "java -version" 1.6 is still coming up! How is this happening when there is literally no reference to 1.6 in my env variables. I have restarted the command line, the computer, everything. This is really bizarre. Is there anywhere else windows might store these references to 1.6 SO I can delete them? Has anyone come across this before? I'm stumped!

Thanks,
Alan
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11418
    
  16

on the command line you want to use, echo out your path. make sure there really REALLY isn't a jdk1.6 in there.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 162

fred rosenberger wrote:on the command line you want to use, echo out your path. make sure there really REALLY isn't a jdk1.6 in there.


There isn't any reference at all to a jdk in my path. I don't get it.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11418
    
  16

is there a reference to some other variable, like a "javahome" or something?

of course, I think you can use java 1.6 and tell it to compile as a 1.5 class file. see this.
Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 162

fred rosenberger wrote:is there a reference to some other variable, like a "javahome" or something?

of course, I think you can use java 1.6 and tell it to compile as a 1.5 class file. see this.


Theres absolutely no references to anything java in the path or env variables. Windows strikes again! I'll do it in a linux vm. Cheers for the link, ill take a look.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Alan Smith wrote:
fred rosenberger wrote:on the command line you want to use, echo out your path. make sure there really REALLY isn't a jdk1.6 in there.


There isn't any reference at all to a jdk in my path. I don't get it.


Sometimes, java.exe is installed in the windows directory. Take a look at your path, and see if there is a java.exe in any of your windows path. Regardless, don't delete it -- just put the older JDK earlier in your path.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11418
    
  16

Windows 7 does have a decent search feature. On your Start menu there is a "search programs and files" option - search for java.exe. Mine found one in C:\Windows\System32 that is 1.6, but I have 1.7 installed somewhere else.
Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 162

fred rosenberger wrote:Windows 7 does have a decent search feature. On your Start menu there is a "search programs and files" option - search for java.exe. Mine found one in C:\Windows\System32 that is 1.6, but I have 1.7 installed somewhere else.


Yup, that was it. java was in the System32 folder and was overriding whatever was in my path. I deleted it and now it points to 1.5 Won't for get that now for future reference! Cheers.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11418
    
  16

So you decided to ignore Henry's advice?
Henry Wong wrote:Regardless, don't delete it -- just put the older JDK earlier in your path.


Deleting executables can be dangerous if you don't know exactly what you are doing...it is possible that by deleting this, you have broken something else - and you may not find out about it until weeks or months from now...
Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 162

fred rosenberger wrote:So you decided to ignore Henry's advice?
Henry Wong wrote:Regardless, don't delete it -- just put the older JDK earlier in your path.


Deleting executables can be dangerous if you don't know exactly what you are doing...it is possible that by deleting this, you have broken something else - and you may not find out about it until weeks or months from now...


I didn't ignore it. The path didn't have any java information in it so it must have been picking up java from System32. I tried Henry's suggestion, didn't work. It's working now. I just need the jdks for dev work so I'm not to worried about deleting java in System32. Everything is working ok now.
 
 
subject: Installing and using a different jdk on Windows 7