Q: How to detect which JAVA VM is installed?

J

Jan Vinten

Hello,

I'm looking for a javascript, that can detect which java VM is installed and
what the current version is.

Can any of you give me some details?

Best regards,
Jan
Denmark
 
M

Martin Honnen

Jan said:
I'm looking for a javascript, that can detect which java VM is installed and
what the current version is.

Using Liveconnect calls from JavaScript to Java you can read out Java
properties with Netscape 4, Netscape 7 and I think with Opera 7:

if (navigator.javaEnabled() && typeof java != 'undefined') {
alert(
'java.version: ' + java.lang.System.getProperty('java.version')
+ '\n'
+ 'java.vendor: ' + java.lang.System.getProperty('java.vendor'))
}

But that will start up the Java VM.

You could also look into navigator.plugins:

var pluginName = 'Java Plug-in';
for (var i = 0; i < navigator.plugins.length; i++) {
var plugin = navigator.plugins;
if (plugin.name == pluginName) {
alert(plugin.description);
break;
}
}

That shouldn't start up the Java VM but is obviously restricted to
browsers that use a plugin such as that from Sun to run Java applets and
that support the navigator.plugins array.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top