[applet] handle wrong jre

O

oliv

Hi,
I have an applet written with java5.
Suppose someone tries to execute it with a jre4.
java console will print a system exception.
But how can I handle that exception properly and show a user friendly
dialog box telling that a jre update is needed ?
thanks !
 
A

Andrew Thompson

I have an applet ..

You like trouble?
..written with java5.
Suppose someone tries to execute it with a jre4.

As they might. End users are mean that way.
java console will print a system exception.
But how can I handle that exception properly and show a user friendly
dialog box telling that a jre update is needed ?

One (almost) solution
<http://www.physci.org/codes/jre.html>

A far better solution. Use JWS To launch the applet..
<http://www.physci.org/jws/#jtest>
..and for versioning..

No worries.
 
R

Roedy Green

I have an applet written with java5.
Suppose someone tries to execute it with a jre4.
java console will print a system exception.
But how can I handle that exception properly and show a user friendly
dialog box telling that a jre update is needed ?
thanks !

I handle it with some generated boilerplate that says which version of
Java is required. See
http://mindprod.com/jgloss/applet/holidaycalculator.html

I also have a method that checks the Java version. However, in many
cases the code won't even start without a proper match.
See http://mindprod.com/products1.html#COMMON11
Look for com.mindprod.common11.VersionCheck

On my todo list is to write some JavaScript boiler plate to test the
Java version and display a message instead of the Applet if it is bad
or there is no Java at all.
 
R

Roedy Green


1. could you add 1.6?

2. the docs should probably say [requires 1.3+] etc.

3. it would be clearer if instead of [v1.2] you said [value="1.2"]

4. it is not clear what you are doing with all those vxx links.
Perhaps a real-life example of use would be best, with the <param
shown without having to peek at the source.
 
A

Andrew Thompson

1. could you add 1.6?

hmm.. I only resurrected the JRE page at the specific
request of a user. I am not convinced it is a good
method to use, given the vagaries of showDocument().

But.. if you wanted to update it for 1.6, you might
change ..

...
Class.forName("java.lang.Appendable");
javaVersionNumber++;
...

...for this..

...
Class.forName("java.lang.Appendable");
javaVersionNumber++;
Class.forName("java.awt.Desktop");
javaVersionNumber++;
...

It would be nice to keep the classes as all
java.lang.??, but as far as I dould determine,
there were no new *classes* in lang for 1.6.
2. the docs should probably say [requires 1.3+] etc.

It is compiled for Java 1.1. I thought that would be
'inuitively obvious', but your comment makes me realise
my mistake*.
3. it would be clearer if instead of [v1.2] you said [value="1.2"]

Good point*.
4. it is not clear what you are doing with all those vxx links.
Perhaps a real-life example of use would be best, with the <param
shown without having to peek at the source.

Not sure I understand what you mean, but the unfortunate
thing for most developers is that having a recent VM means
it is very hard to see it 'redirect' - unless I include
arbitrary values (version='9.3').

* Things I would change, assuming I ever revisit that
page. But personally, I think JWS provides better
versioning options, and applets are (largely) passe,
in any case..

Andrew T.
 
R

Roedy Green

Not sure I understand what you mean, but the unfortunate
thing for most developers is that having a recent VM means
it is very hard to see it 'redirect' - unless I include
arbitrary values (version='9.3').


You need a paragraph something like:

"Below are invocations of the Version Check Applet that will redirect
you if your browser is not sufficiently recent. If you have the
latest browser, clicking the link won't do anything."

I don't understand what those links do. I know it is obvious to you,
but not to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top