This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to detect the JVM version of the browser like IE or Netscape navigator?

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to detect the JVM version of the browser like IE or Netscape navigator? or if at all JVM is present? Either JavaScript or Applet should be used to find out the JVM version.
Thanks.
Shashikanta
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html, the getProperties method.
 
Shashi Kanta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Yes, we can use System.getProperty("java.vm.version") to get the JVM version.
But, isn't that the JVM version for the JDK installed on your machine? Also, when I try to access my applet which invokes this property, on some machine that doesn't have JDK installed, it throws Security Exception.
regards,
Shashi
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But, isn't that the JVM version for the JDK installed on your machine?


Shashi,
This is quite browser dependent. M$ Internet Explorer comes with a built-in Virtual Machine (actually, it is probably part of the Windows OS). The MS VM is stuck at Java version 1.1.4, due to their legal scuffles with Sun. The IE browser can also use Sun's Java Plugin, which provides the very latest version of VM.
The old Netscape version 4 browsers also came with a built-in JVM. Netscape 4.7x browsers had a Java 1.1.7 JVM.
Mozilla was developed without an internal JVM, and has always relied on the Sun plugin for Java functionality. Netscape 6.0, 6.1 and 7.0 also are like this, but they do ship with a plugin pre-installed.
The latest Sun plugins will ask on installation if they should be made availabel to IE5 and Netscape 6+ browsers.
I don't know how Opera gets Java capability, but I suspect it also uses a third-party plugin.

Also, when I try to access my applet which invokes this property, on some machine that doesn't have JDK installed, it throws Security Exception.


This is probably in an Internet Explorer browser with the default MS VM.
Try getting an Enumeration of the System properties and listing them to see what you actually have available to you.
PCS
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you seen this thread? It may help.
 
I once met a man from Nantucket. He had a tiny ad
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic