Determen Java evalibility and version.

D

Dani Shapira

Hi.
can anyone help me with how to find if JAVA is evalible and if yes,
of what version?
Thanks
Dani
 
R

Randy Webb

Dani said:
Hi.
can anyone help me with how to find if JAVA is evalible and if yes, of
what version?

comp.lang.java is over there ============>

Java != Javascript
 
D

Dani Shapira

Randy said:
comp.lang.java is over there ============>

Java != Javascript
I know that Java and Javascript is not the same!!!!
The quetion is: How can I, in JavaScript, find out if Java is avaliable
for this browser to run applet og later page.
 
M

Martin Honnen

Dani Shapira wrote:

The quetion is: How can I, in JavaScript, find out if Java is avaliable
for this browser to run applet og later page.

Most browsers should support
if (navigator.javaEnabled()) {
...
}
Testing the Java version is probably better done then in a Java applet
itself, only a few browsers (Mozilla, Opera) support LiveConnect
JavaScript->Java direct access e.g.
if (navigator.javaEnabled() && typeof java != 'undefined') {
alert(java.lang.System.getProperty('java.version'));
}

As long as browsers are using the Sun Java plugin you can also look into
the navigator.mimeTypes e.g.

var mimeType = navigator.mimeTypes ?
navigator.mimeTypes['application/x-java-applet'] : null;
if (mimeType) {
var plugin = mimeType.enabledPlugin;
if (plugin) {
alert(plugin.description);
}
}
for me here on Windows that shows
Java Plug-in 1.5.0_01 for Netscape Navigator (DLL Helper)
so you could try to extract the version from that string.

But IE/Win doesn't support navigator.mimeTypes for such stuff.
 
R

Randy Webb

Dani said:
I know that Java and Javascript is not the same!!!!
The quetion is: How can I, in JavaScript, find out if Java is avaliable
for this browser to run applet og later page.

In short, you can't reliably. There are too many other factors that
affect it, as Martin pointed out. It also fails if scripting is disabled
or not present. And these very reasons are why I directed you to a Java
Newsgroup. The Java gurus are better prepared to tell you how, in Java,
determine what you are wanting to know.

comp.lang.java
 

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,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top