Java plugin

I have an applet (chopped down demo for a game I have been working on) and I’m wondering what’s the best way to insure that the user has at least the 1.2 jre installed.

I realize there are a few options, the first one is setting it so that a browser will use the java plugin, this seems to have a few issues, for one it’s ugly embedding things (especially since ie and netscape handle that differently), and it seems to require that you have different code for each possible acceptable jre (like 1.2 1.3 1.4 etc… potentially 1.4.2 or even 1.4.2_08), and if that’s the case, you would also have to make sure that if multiple acceptable versions exist that only one actually runs… This option sucks.

Another option is to use webstart, it handles the verion issue which is a good start, but the reason this thing is an applet is hopefully one day it can appear on some of the portal sites, portal sites don’t seem to be too keen on webstart just yet, this is still an option but I don’t trust webstart and I hate to include that extra layer when in the past all I can rely on it to do is make it so that 1 out of 3 people can’t play my game for no apparent reason…

And the final option I’m aware of is simply use the applet tag, and pray most people have a jre that’s suitable installed already, and notify them that if the program doesn’t start they need to go get java from sun. This isn’t such a bad option, particularly if you can check if they need to go get it in the first place. I’m open to ideas on that…

Anyway, what do the people of this forum feel is the best option, I’m leaning towards the third one, or maybe a perfect option someone else might suggest in a reply.

im confused, didn’t webstart appear in 1.4? So if you chose the webstart route, you would ensure that the users had 1.4+?

If it was me, id go down the applet route…make a 1.1 compatible applet which checks for the java type, if its equal or greater than 1.2, then launch another applet which utilises 1.2 or greater…If not, direct em to the java site.

1.1 because all of IE’s (and netscape?) support that by default.

DP

HTMLConverter (shipped with jdk) does the Object/Embed for you, you just have to provide an HTML page with an applet tag.
You can then specify, as with java web start, a minimum version of java (i have done that in the past, if i remember well, you can specify either a miminum number or a strict number).

and of course, with an APPLET tag, you could use an Applet class 1.1 compliant (no swing, no ArrayList…) and
check the System.getProperty(“java.version”) > = “1.2”

Then you class.forName(…) your real applet content when you are sure of the jva version.

Hope it helps

Lilian

Java webstart is compatable with older versions of java, just like swing, originally it was not part of the standard install.

c_lilian: Thanks, I knew there was a tool for making the plugin pages, but wasn’t sure of the name… and after finding it and running it, I declare it crap.

The class loader option should work, haven’t messed with that stuff much myself, but going to go give that a try now.

c_lilian: Seems like the class loading route will work, the down side is um, I’m not sure how to handle it so that the actual applet makes a call to getAppletContext() returns the applet context, instead of a null pointer. I can’t seem to find an example of this. Know of an example of how this is done?

Soon as I post I think I figured it out… will post details when I got more time.

OK, it seems to work good. If anyone wants a simple applet that should allow them to specify a minimum jre version let me know, I’ll email them the code.