Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (789)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Code Request: Plugin Detection  (Read 5418 times)
0 Members and 1 Guest are viewing this topic.
Offline markuskidd

Junior Devvie

Medals: 1

« Posted 2002-10-29 18:55:24 »

I think I have seen this out there somewhere but I can't locate it. If anyone has it handy, I'm looking for some short, neat code to detect what version JVM a browser is using, and if it is less than a version I specify, popup a new browser window to the handy new "Get Java" page at
I know about the HTML converter that Sun has, but that's messy and you have to point it to a specific ver. of the JVM, which is not what I'm looking for.
If anyone has this or a link to it, I'd really appreciate it.
Offline ap_kelly

Junior Devvie

Java rocks!

« Reply #1 - Posted 2002-10-30 03:41:02 »

I think the HTML converter is just what you're looking for!

You specify a minimum version of the JVM that you need (as one of the parameters) and if the client has an earlier version they are directed to go and get the correct version.

Here is some simple code I wrote a while ago to do this very thing.

<PARAM NAME="code"             VALUE="myApplet.class">
<PARAM NAME="codebase"         VALUE="lib">
<PARAM NAME="archive"          VALUE="myApplet.jar">
<PARAM NAME="type"             VALUE="application/x-java-applet;version=1.3.0_01">
<EMBED type="application/x-java-applet;jpi-version=1.3.0_01"
Java 1.3 has not been detected by your browser. Please follow the instructions in the installation guide with regard on how to setup Java.    

Offline ap_kelly

Junior Devvie

Java rocks!

« Reply #2 - Posted 2002-10-30 03:44:59 »

One of the other topics in this section also covers this. Try this peice of code in your applet.

String version = System.getProperty("java.specification.version"); 

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline markuskidd

Junior Devvie

Medals: 1

« Reply #3 - Posted 2002-10-30 14:55:37 »

This line here is what I'm talking about: codebase=",3,0,1

It seems extremely counterintuitive to me that if I'm going to make my users go through the looong download of the JRE, I should have to hard-code a specific *filename* for the download... shouldn't I be able to redirect them to the "Get Java" page so they can get the latest one? Also, I have a feeling that "" is not going to be what my Mac/Linux users want. So then I can add another one of these monsterous sections for each operating system -- not what I'm looking for again. Just directing them to the "Get Java" page should be fine, but how to do that? I'm thinking I've seen this done, probably with javascript.

Re the other suggestion of getting their version, I don't want to fool with a custom loader class -- this detection should be done outside of the applet itself.

Thanks for the replies guys, but I did say that the HTML converter is not what I'm looking for  ;D I can't see how Sun would endorse that as the most elegant way of getting the plugin...
Offline kenrod

Senior Newbie


« Reply #4 - Posted 2002-10-31 01:42:41 »


You need to take a step back and think about what you're asking here.

First, the 'codebase' line you're referring to is an attribute of an 'object' tag. That tag, in turn, is an ActiveX command that will ONLY be understood by Internet Explorer and ONLY on Win32. So, you've no need to worry about Mac/Linux users Smiley

(as an aside, the original ActiveX downloading spec allowed you to specify different ActiveX binaries for different platforms, but seeing as how Microsoft have discontinued IE for Unix...

...I don't think this will be a problem going forward!)

The 'embed' tag (which only Netscape 4.7x understands) DOES have a 'pluginspage' attribute which will automatically redirect the user to '' if you want (not in the example given by ap_kelly, but I'm sure you can tweak that).

Outside of the 'automatic downloading' world, you can simply offer a link to 'Get Java' (Sun has a Java Banner Program you can sign up for), much as you would Shockwave.

Personally, I'm not a big fan of the converter either. A much better way is to use the standard JSP taglibs (they have an 'embed applet' tag). However, neither of those produce as robust a solution as is discussed on...

...(which features my favourite quote 'Although this tag seems complicated compared to the old APPLET tag, it is not.'), so you can always implement your own JSP taglib to do that.

In fact, if JSP is the way to go for you, I can post such a taglib here.

As proof all this really does work, please feel free to check out my site at...
Offline markuskidd

Junior Devvie

Medals: 1

« Reply #5 - Posted 2002-10-31 16:20:59 »

Well, 95% of the visitors to my site use IE, so for the majority would still be getting a hard-coded JRE binary.

I thought IE ran on Mac as well though? I should just check my web logs but I think that a significant portion of the Mac requests I get come from IE.

One thing that really seems off-color about the HTML converter doc is that it relies on the fact that Netscape does/has ignored the contents of a COMMENT tag in HTML. I think I'm going to have to learn some javascript, because I think the best way to to this is to ask the browser if there is a Java plugin, ask it what version it is, and if it is less than version X sent it to the Get Java page. I'm not sure what the capabilities of javascript are, but this seems sooooo much more simple, it would run on any machine that has javascript (and has a standard plugin interface, I would imagine). I think that I've *seen* this somewhere, but I can't find it so perhaps it has been a figment of my imagination all along.

The JSP solution seems ideal, but right now I'm (ugh) stuck with a combination of IIS and vanilla apache, so I'm working within some pretty well-defined limits. I may need or want to work with servlets in the future, so at that point this problem will be moot for me -- I do think though that a general solution would benefit people who are trying to decide whether they want to code to 1.1 or have people get a current VM. Making everyone wait for the whole JRE is bad enough, but when you have to get messy with custom tags and browser-specific coding I think that's twice the turn-off.

I'll see what I can find and post anything useful here...
Pages: [1]
  ignore  |  Print  

hadezbladez (2617 views)
2018-11-16 13:46:03

hadezbladez (944 views)
2018-11-16 13:41:33

hadezbladez (2571 views)
2018-11-16 13:35:35

hadezbladez (509 views)
2018-11-16 13:32:03

EgonOlsen (3738 views)
2018-06-10 19:43:48

EgonOlsen (4136 views)
2018-06-10 19:43:44

EgonOlsen (2496 views)
2018-06-10 19:43:20

DesertCoockie (3303 views)
2018-05-13 18:23:11

nelsongames (3399 views)
2018-04-24 18:15:36

nelsongames (4376 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!