Re: detecting which jvm version is being ran?
Mickey Segal wrote:
"Andrew Thompson" <andrewthommo@gmail.com> wrote in message
news:1164065950.777383.149050@j44g2000cwa.googlegroups.com...
<http://www.physci.org/pc/jtest-applet.jnlp>
At www.segal.org/java/config/ we use the following code to get the maximal
information about the Java version:
if ((System.getProperty("java.vendor").startsWith("Microsoft")))
javaVersion = "java.version = " +
System.getProperty("java.version");
else javaVersion = "java.vm.version = " +
System.getProperty("java.vm.version");
The applet is unsigned and it works without security messages in any
environment that I've checked.
I'm using a technique similar to this, now, and am being told by
someone that it crashes their browser.
Here's my code:
import java.applet.*;
import java.awt.*;
public class ShowInfo extends Applet
{
String output = "", javaVendor, javaVersion;
public void start() {
try {
javaVendor = System.getProperty("java.vendor");
javaVersion = javaVendor.startsWith("Microsoft") ?
System.getProperty("java.version") :
System.getProperty("java.vm.version");
} catch (Exception e) {
//e.printStackTrace();
}
}
public void paint(Graphics g) {
g.drawString(javaVendor,10,25);
g.drawString(javaVersion,10,50);
}
}
I tried it, myself, on IE6 with MSJVM 1.1 and FF2 with Sun JVM 1.5 and
both worked. I don't know what browser their using nor do I know the
JVM vendor / version (that's what this script was supposed to find
out...)
Any ideas? Maybe I should be using something more like what Arne
Vajh=F8j posted?