This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes detect JVM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "detect JVM" Watch "detect JVM" New topic

detect JVM

Cathy Young
Ranch Hand

Joined: Mar 02, 2002
Posts: 126
I have a web application, in which an applet is included. If the user does not have JVM, I want to redirect them to SUN website to download it. The question is: how can I detect the JVM on the client's machine? I found a lot of examples using applet, but I do not think they can work in my application, because the purpose for me to detect the JVM is to run the applet. Help please? Thanks!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

You need to use the OBJECT tag. An example might look like:

Read this for more details.

GenRocket - Experts at Building Test Data
Cathy Young
Ranch Hand

Joined: Mar 02, 2002
Posts: 126
Thanks, Gregg! That is very helpful. One more question: after downloading the JRE, the JSP page complains that the applet which has been working on those clients with JRE is not initialized. Anything special needs to be included in the init () method? Thanks a lot!
Harry Wood

Joined: Jan 28, 2004
Posts: 16
It think there must be some error ocurring during normal execution of your java code. Take a look in the console (in internet explorer go to tools menu -> sun java console) to see if there's any Exceptions being reported.
Cathy Young
Ranch Hand

Joined: Mar 02, 2002
Posts: 126
Thanks! I finally figured out what the problem is. There was a "name" declared when I was using the "applet" tag, and left it out when I changed it to "object" tag. So when my applet is referenced by this name, it is null. Thanks guys!
It is sorta covered in the JavaRanch Style Guide.
subject: detect JVM
Similar Threads
how to detect which browser (IE or netscape) from applet
applet and application
detect JVM plugin version
detecting browser name/version from an Applet
Tab doesn't work in applet