When testing to see whether a user with IE under Windows XP has the Microsoft JVM installed, the JavaEnabled property always comes back as True, even when the user does not have the JVM installed. How can I determine whether indeed the user has the JVM installed?
Under Windows XP, IE reports that Java is enabled even if there is no JVM installed on the machine. In this respect the browser considers Java enabled because it has not explictly been disabled (even though it is not installed, as strange as that may seem).
To determine whether the JVM is installed, you should check the MSJVMBuild property if the visitor is using IE on Windows XP. If MSJVMBuild comes back as an empty string, then the JVM is not installed. Here is the code to do this check:
bh.SetExtProperties "MSJVMBuild, JavaEnabled"
if bh.browser = "Netscape" and bh.version >= 6 then
specialCase = true
if bh.Browser = "IE" AND bh.Platform = "WinXP" = True AND bh.MSJVMBuild = "" then
... user does not have MS JVM installed
elseif specialCase = True AND bh.Plugin_JavaVer = "" then
... user has Netscape 6+ without any Java plugin
... and therefore is unable to run any Java without
... downloading the Java plugin.
elseif bh.JavaEnabled = False then
... user has Java disabled
... Java is enabled and available
Note that in addition to handling the condition where the Microsoft JVM is not installed under Windows XP, this script also demonstrates how to determine if a Netscape 6+ user has Java available (this is a separate matter than what this article addresses, but we thought we'd demonstrate it at the same time since these matters are somewhat related - for more information see the JavaEnabled property in the BrowserHawk documentation).