Detect version of Java using JavaScript

Is there a reliable way of detecting what version of Java is installed on the client's machine using JavaScript?



Check out the code in the Java Deployment Toolkit.


According to the fact that we're finding this page with google, just to help the next guys finding this.

Is Java installed?


Which version of Java is installed?

<script src=""></script>
var versions = deployJava.getJREs();

It's the best way I found to find the version of Java with JavaScript, but use it carefully because its version detection is really os/browser dependent, and on old browser version or on recent browser with old Java installed, it'll not work as expected. Take the time to do real tests before to use it in production.


Googling for

detect "java version" using javascript

yields a couple of results, this one looks like it might be useful. In essence, it tries to load a Java applet and then JavaScript asks the applet.


You can use the PluginDetect library from here:


Version of Java:

 * @return NULL if not version found. Else return some things like: '1.6.0_31'
var JavaVersion: function()
  var result = null;
  // Walk through the full list of mime types.
  for( var i=0,size=navigator.mimeTypes.length; i<size; i++ )
      // The jpi-version is the plug-in version.  This is the best
      // version to use.
      if( (result = navigator.mimeTypes[i].type.match(/^application\/x-java-applet;jpi-version=(.*)$/)) !== null )
          return result[1];
  return null;

Is Java and is Java enable:

var IsJava: function()
  return typeof(navigator.javaEnabled) !== 'undefined' && navigator.javaEnabled();

These functions works on Opera, Firefox, Chrome. I havn't IE.


The detection logic does not work in IE32 on Windows7-64. It could not detect the java version it installed earlier.

Well, after further reading, the Java Deployment Toolkit on Windows uses ActiveX classid which may pose your app to hackers (see I am out.


If you use Google Analytics, this post might be helpful (see the forum thread for more details).


I find that the JavaScript solution provided by the Java Deployment Toolkit gives an error... "deployJava.do_initialize is not a function".

One solution that I have used extensively for many years that does work in all browsers is the Java Version Display Applet. Unfortunately the original author's site seems to have disappeared, but you can download a copy of the Java Version Display Applet here.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.