0

I am trying to use deployJava to get client java version. But deployJava.getJREs() is returning empty value. I am using windows 7-64bit.
Is there any way to detect client java version?

Mohi
1,7981 gold badge28 silver badges42 bronze badges
asked Apr 23, 2015 at 7:49
2
  • FYI Commented Apr 23, 2015 at 7:51
  • What does this have to do with JavaScript? Commented Apr 23, 2015 at 7:54

1 Answer 1

2

firstly you need to verify whether java is enabled on client machine using below code snippet

navigator.javaEnabled()

if it returns true that means java is enabled and now futher you below code snippet

Version of Java:

 /**
 * @return NULL if not version found. Else return some things like: '1.6.0_31'
 */
 var JavaVersion: function()
 {
 var resutl = 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( (resutl = navigator.mimeTypes[i].type.match(/^application\/x-java-applet;jpi-version=(.*)$/)) !== null )
 return resutl[1];
 }
 return null;
 }

or you can use javascript

<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var versions = deployJava.getJREs();
</script>
answered Apr 23, 2015 at 7:57
Sign up to request clarification or add additional context in comments.

1 Comment

The first script throws an error, but the second one returns a version number

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.