5 Replies Latest reply: Jan 2, 2013 3:25 PM by 818043 RSS

    How does deployJava.versionCheck work?

      To check the version of JRE on the Windows client, the script "if (deployJava.versionCheck('1.x'))" is used.

      For example,
      if (deployJava.versionCheck('1.6+'))
      checks if the JRE software on the client is 1.6 or higher.

      Does anyone know exactly what this script is looking at on the desktop to determine the version of JRE installed? For example, does it check the registry?
      If not, what?


      Edited by: 815040 on Jan 2, 2013 12:44 PM

      Edited by: 815040 on Jan 2, 2013 1:04 PM

      Edited by: 815040 on Jan 2, 2013 1:13 PM

      Edited by: 815040 on Jan 2, 2013 1:30 PM

      Edited by: 815040 on Jan 2, 2013 1:45 PM
        • 1. Re: How does deployJava.versionCheck work?
          It is JavaScript. It does not touch the registry.
          Here is text version of the script: https://www.java.com/js/deployJava.txt (https://www.java.com/js/deployJava.js)

          How it determines the JRE version is based on the browser. Have a look at the script.

          A couple URLS:

          • 2. Re: How does deployJava.versionCheck work?
            Its Javascript, so no it cannot do things like check the registry. It would be terrible if such things were possible from a browser scripting language.

            You can always investigate the source yourself, but I believe it does a DHTML trick to try and render the version check applet on the java.com website. That applet returns the necessary runtime information to validate the conditions you specify.

            EDIT: ninja'd by dr. Oracle himself!
            • 3. Re: How does deployJava.versionCheck work?
              Thanks for the reply. I know nothing about JavaScript, but it looks like deployJava.versionCheck causes another function, getJREs() to execute, and that function returns the version(s) of Java JRE installed on the computer. Any ideas as to where getJREs() gets the information about what version of JRE is installed?
              • 4. Re: How does deployJava.versionCheck work?
                Again, it depends. There is lots of code in that file because of all the variations with browsers, the versions of Java.... there is no easy single answer.

                Here is method for FF:
                    // obtain JPI version using navigator.mimeTypes array
                    // if found, set the version to this.firefoxJavaVersion
                    getJPIVersionUsingMimeType: function() {
                        // Walk through the full list of mime types.
                        for (var i = 0; i < navigator.mimeTypes.length; ++i) {
                            var s = navigator.mimeTypes.type;
                // The jpi-version is the plug-in version. This is the best
                // version to use.
                var m = s.match(/^application\/x-java-applet;jpi-version=(.*)$/);
                if (m != null) {
                this.firefoxJavaVersion = m[1];
                // Opera puts the latest sun JRE last not first
                if ('Opera' != this.browserName2) {
                Don't know much about mimeType Arrays myself, Google is helpful though:
                I suspect you are seeing some error or problem, which is why the question was first asked. If so, what is not working, or not working as expected? 
                not a ninja or a doctor :)
                Edited by: EJP on 3/01/2013 08:55: added code tags                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                • 5. Re: How does deployJava.versionCheck work?
                  One of the websites in my company uses the deployJava.versionCheck function to display the version of Java JRE present on the computer, and I was curious as to exactly how that function determined what version of Java is installed. I'll dig into it further with all of the information you gave me. Thanks again!