Identifying Java Version from Registry.

Posted by Paul Mowat on 09-Jan-2015 09:25

Hi All,

OS: Win 7 64bit

OE: 10.2B SP 8 32bit

 

I'm trying to determine which version of java is installed from the registry with the following code.

 

DEFINE VARIABLE op-version AS CHARACTER   NO-UNDO.

LOAD "SOFTWARE\Wow6432Node\JavaSoft" BASE-KEY "HKEY_LOCAL_MACHINE" .

USE "SOFTWARE\Wow6432Node\JavaSoft" .

      

GET-KEY-VALUE SECTION "Java Runtime Environment" KEY "CurrentVersion" VALUE op-version.

 

MESSAGE "Paul Mowat - wow64/32" op-version VIEW-AS ALERT-BOX.

 

UNLOAD "SOFTWARE\Wow6432Node\JavaSoft".

 

LOAD "SOFTWARE\JavaSoft" BASE-KEY "HKEY_LOCAL_MACHINE" .

USE "SOFTWARE\JavaSoft" .

      

GET-KEY-VALUE SECTION "Java Runtime Environment" KEY "CurrentVersion" VALUE op-version.

 

MESSAGE "Paul Mowat - 64bit" op-version

VIEW-AS ALERT-BOX.

 

UNLOAD "SOFTWARE\JavaSoft".

 

I have both 64bit and 32bit versions installed.

 

HKLM

|

-> SOFTWARE

                |

                |-> JavaSoft

                                |-> Java Runtime Environment

                                                |-> CurrentVersion = 1.8

                |

                |-> Wow6432Node

                                |-> Java Runtime Environment

                                                |-> CurrentVersion = 1.7

 

I expect the first check to get the 32bit version and the second to get the 64bit version. What is happening though is that they are both finding the value 1.7 that is held against SOFTWARE\Wow6432Node\JavaSoft.

 

My intention is to check for the 32bit version and if not installed drop down to the 64bit version.

 

Anyone have any ideas?

 

Thanks

 

Paul 

        

All Replies

Posted by Stefan Drissen on 09-Jan-2015 09:33

The Wow6432Node is accessed when the calling process is 32-bit.

msdn.microsoft.com/.../aa393067%28VS.85%29.aspx may help.

Posted by Paul Mowat on 09-Jan-2015 09:43

Thanks, but couldn't it be possbile to have someone on 64bit windows, running 32bit progress but with 64bit java java installed. Thats what I'm trying to identify.

Posted by Stefan Drissen on 09-Jan-2015 09:55

Yes, that is possible - but you will then have to perform the 'hack' I provided in the msdn url.

Registry redirection is what you need to google:

Posted by Paul Mowat on 09-Jan-2015 10:04

Yeah, just sussed it out. Thanks for the help.

This thread is closed