Reputation: 1061
I want to run applets in IE10 which requires a least version of java 1.7.0_51.
So before loading applet, I want to check the current installed jre version and display a proper message if the current jre is not suitable.
So to do this we are using deployJava.js (https://www.java.com/js/deployJava.txt).
In this we are calling getJREs function to get the all available jres. But its returning an empty list.
After debugging we found in testUsingActiveX function its not able to create ActiveXObject for version 1.7.0, though the version is installed. Its throwing exception and returning false.
Is there any work around or a better way to solve this issue.
Upvotes: 1
Views: 550
Reputation: 8217
Use navigator.plugins
. I believe it's supported by every major browser, even with older versions. I've tested it with latest versions of Chrome, Firefox, Safari and IE.
Here's a function which returns Java Deployment Toolkit version:
function getJavaVersion() {
// note the extra space, it's used to make split easier
var jdtString = 'Java Deployment Toolkit ';
var jdtIndex = -1;
// find index of JDT inside navigator.plugins
for (var i = 0; i < navigator.plugins.length; i++)
if (navigator.plugins[i].name.indexOf(jdtString) >= 0)
jdtIndex = i;
if (jdtIndex === -1)
return null; // Java Deployment Toolkit was not found
return navigator.plugins[jdtIndex].name.split(jdtString)[1];
}
This returns Java version number, for example 8.0.50.13
, or null
if JDT was not found. Using this number, you can parse out specific version number and compare it to required version.
Upvotes: 1