Java and Versions

(imported topic written by jr6591)

I am trying to identify what version of Java are installed. Unfortunately, i get mixed results depending on what criteria I use. The registry for Java does not clean all older versions so some information is not accurate. I ran this on a PC with version 1.5.0_12 and 6.0 (1.6.0_02). I DO NOT have version 1.4 installed at all yet it still shows. And if I use the reg keys, if it has a version then it shows the 1.6 and 1.6.0_02 (it duplicates info as it really only has 1.6.0_12)

regapp shows only the latest version 1.6.0_02 and it shows it as 6.0.20.6 when using regapp

ANy ideas on how I can nail this thing down?

Q: if exists regapp “javaws.exe” then version of regapp “javaws.exe” as string else “Not Installed”

A: 6.0.20.6

Q: regapps “javaws.exe”

A: “javaws.exe” “6.0.20.6” “Java™ Web Start Launcher” “6.0.20.6” “Sun Microsystems, Inc.”

Q: (name of it & " - " & (if (exists version of it) then (version of it as string) else (“No Version”))) of regapps whose (name of it as lowercase contains “ja”)

A: javaws.exe - 6.0.20.6

Q: concatenation ", " of names of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment” of registry

A: 1.4, 1.5, 1.5.0_12, 1.6, 1.6.0_02

Q: if (exists keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment” of registry)then (concatenation ", " of names of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment” of registry)else (“Not Installed”)

A: 1.4, 1.5, 1.5.0_12, 1.6, 1.6.0_02

(imported comment written by rad.ricka91)

Hi jr,

how about creating a periodic task that would dump output of “java -version” into a file? Then you can parse it and it will surely pick up the right version as you’ll hit the first binary one in the path.

Rad