Solved

switch applet vs. japplet depending on java version

Posted on 2004-03-21
7
1,028 Views
Last Modified: 2007-12-19
I have two chat rooms, one based on Applet, one based on JApplet.  I want the JApplet to be used if the JVM version supports it.

I know to get the version (and vendor, if I like), easily enough from the System properties:
  System.getProperty("java.version")
  System.getProperty("java.vendor")

But I can't think of anything nifty for a way to actually manage classloading or whatnot.  I'm already inside the instantiated class when things begin, so it's already either an applet or a japplet.

I found a nifty javascript version detection script, but it only works for non-IE browsers, and I'd really prefer to do it inside a single jar; let it decide for itself.

if you go to http://nfg.ca/ you can see the chatroom (link: "chat" at the top of the screen) and see the javascript pains I'm going to at the moment. :)
0
Comment
Question by:nentwined
  • 5
  • 2
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10646057
you'll need to implement that in your html, and not in your applet.
0
 
LVL 92

Expert Comment

by:objects
ID: 10646064
although you could try loading an Applet which checks the version and then embeds the required applet inside itself (applets are just components so can be added like any other).
0
 
LVL 92

Expert Comment

by:objects
ID: 10646076
probably easier though to implement in your html using the <object> tag.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:nentwined
ID: 10646140
can you use the object tag to specify which version of java is required for it?

I just implemented an applet which checks version and then redirects to a different page depending; that was painless enough.

As for embedding, I was worried about values being passed on down the line, such as parameters and whatnot.  But it's a plausibility.

how backwards-compatible is the object tag?
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 10646160
The object tag can only be used for loading the plugin (and thus use JApplet), if it isn't present then you can use applet tag (to load Applet).

> I just implemented an applet which checks version and then redirects to a different page depending; that was painless enough.

thats a good solution.
0
 

Author Comment

by:nentwined
ID: 10646191
I'll have to look into the object tag.  Thanks both for your ideas. :)
0
 
LVL 92

Expert Comment

by:objects
ID: 10646203
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now