Solved

switch applet vs. japplet depending on java version

Posted on 2004-03-21
7
1,076 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

623 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