Problem with Applet Under Mac Leopard

R

Roedy Green

A naive user has written me saying an Applet is "broken" under Mac OS
Leopard with Java 1.6.

The applet is at http://mindprod.com/applet/canadiantax.html

I wonder if someone with Leopard could give it a poke and give me a
better clue of just how it is failing.

All it does is compute Canadian sales taxes for the various provinces.

There is an equivalent one for the USA at
http://mindprod.com/applet/americantax.html

Also could anyone with a Leopard tell me what you do to turn on the
Java error console. I would like to add that to the entry at
http://mindprod.com/jgloss/console.html
on how to turn on the console in various platforms.
--
Roedy Green Canadian Mind Products
http://mindprod.com

If everyone lived the way people do in Vancouver, we would need three more entire planets to support us.
~ Guy Dauncey
 
R

Roedy Green

Can't tell for sure, but looks like you might have an infinite loop
somewhere.

When I try to load it in the browser normally, the applet is empty, with
the little "X" doc icon in the upper left. On Safari, if I switch tabs
and come back a minute or so later, the "X" eventually disappears. On
Opera, it seems to remain. In neither case does it get far enough to draw
anything.

What does is the os.name property for Leopard? See
http://mindprod.com/applet/wassup.html

I have added some progress messages that might help track down where
it is getting stuck. Could you please give it another poke.

You should see:
selecting fonts...
setting L&F...
creating components...
calculating default values...







--
Roedy Green Canadian Mind Products
http://mindprod.com

If everyone lived the way people do in Vancouver, we would need three more entire planets to support us.
~ Guy Dauncey
 
J

John B. Matthews

Roedy Green said:
A naive user has written me saying an Applet is "broken" under Mac OS
Leopard with Java 1.6.

The applet is at http://mindprod.com/applet/canadiantax.html

I wonder if someone with Leopard could give it a poke and give me a
better clue of just how it is failing.

All it does is compute Canadian sales taxes for the various provinces.

java.lang.UnsupportedClassVersionError: Bad version number in .class file

Compiles and runs under 1.5 fine, though. Java version "1.5.0_19" is the
current default. There's a 1.6 applet plugin, but it's 64-bit only.
There is an equivalent one for the USA at
http://mindprod.com/applet/americantax.html

Same error; not compiled.
Also could anyone with a Leopard tell me what you do to turn on the
Java error console. I would like to add that to the entry at
http://mindprod.com/jgloss/console.html
on how to turn on the console in various platforms.

Applications > Utilities > Java > Preferences.app > Advanced > Show
console.
 
J

John B. Matthews

Also could anyone with a Leopard tell me what you do to turn on the
Java error console. I would like to add that to the entry at
http://mindprod.com/jgloss/console.html
on how to turn on the console in various platforms.

Applications > Utilities > Java > Preferences.app > Advanced > Show
console.[/QUOTE]

Oops, that should be

Applications > Utilities > Java Preferences.app > Advanced > Show
console.
 
R

Roedy Green

java.lang.UnsupportedClassVersionError: Bad version number in .class file

Compiles and runs under 1.5 fine, though. Java version "1.5.0_19" is the
current default. There's a 1.6 applet plugin, but it's 64-bit only.

I ran the entire body of utilities through Jarcheck and was astounded
to find all kinds of that sort of error. I have tracked down the
causality chains and repaired everything. Reposting is in progress.

It is so weird the way things can be causal in computers that don't on
the surface have anything to do with each other than they were
recently changed. Perhaps that is why humans so easily presume
causality when things occur together.

Does the Mac OSX 1.6 need a 64-bit OS to run? If not, should it not
have been happy with the 1.6 class versions?
--
Roedy Green Canadian Mind Products
http://mindprod.com

If everyone lived the way people do in Vancouver, we would need three more entire planets to support us.
~ Guy Dauncey
 
J

John B. Matthews

"Peter Duniho said:
[...]
Does the Mac OSX 1.6 need a 64-bit OS to run? If not, should it
not have been happy with the 1.6 class versions?

Yes. Java 1.6 on the Mac is 64-bit only. :( It can't even be
installed on OS versions earlier than Leopard. Grrr...

I still don't know why that should matter. Yes, 1.5 is the default
host for an applet, but it seems to me if you've published your
applet requiring 1.6, the OS should be smart enough to use the
64-bit, 1.6 run-time. Maybe it can't handle a 64-bit Java run-time
in the web browsers? On Windows, the 64-bit OS can run 32-bit apps,
but those apps can't load 64-bit code. Maybe Leopard has a similar
issue. If Opera is 32-bit code, that might explain that. But I'd
think Apple would've provided a 64-bit Safari, and your applet is
broken there too. (In fact, I just checked, and Apple's web site
says Safari is a 64-bit app).

Indeed, I can compile and run Java applications and applets with 1.6.
Applets run fine in Applet Launcher, appletviewer and my editor's HTML
previewer; but Safari insists "Bad version number in .class file."
Oh well, there's a lot about Java on the Mac that seems weird and/or
user-unfriendly to me. So there you go. :)

What Apple calls "Java for Mac OS X 10.5 Update 4" fixes a number of
lingering security problems:

<http://support.apple.com/kb/HT3632>

Several gotchas: 1) Java Preferences no longer changes versions, but
relinking still works:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo ln -fhsv 1.6 CurrentJDK

2) The aliases in /Developer/Applications/Utilities for Applet Launcher
and Jar Bundler are removed, the originals are still available in
/usr/share/java/Tools.

3) Several commands in NetBeans break; most seem related to creating new
files or projects:

Sounds like you've got a solution, thanks to John's info. Sorry I
wasn't able to produce more useful information myself (not sure what
the whole "freezing up" thing was all about).

Both applets are running fine, now:

<http://mindprod.com/applet/americantax.html>
<http://mindprod.com/applet/canadiantax.html>
 
V

vkj

Hello,
Several gotchas: 1) Java Preferences no longer changes versions, but
relinking still works:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo ln -fhsv 1.6 CurrentJDK


I tried the step 1 mentioned above, however Safari/Firefox still
defaults to using version 1.5. Can you confirm that by creating the
softlinks as mentioned here, you were able to get the applet displayed
on the browser?

Thanks
vkj
 
J

John B. Matthews

vkj said:
Indeed, I can compile and run Java applications and applets with
1.6. Applets run fine in Applet Launcher, appletviewer and my
editor's HTML previewer; but Safari insists "Bad version number in
.class file." [...]
Several gotchas: 1) Java Preferences no longer changes versions,
but relinking still works:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo ln -fhsv 1.6 CurrentJDK
[...]
I tried the step 1 mentioned above, however Safari/Firefox still
defaults to using version 1.5. Can you confirm that by creating the
softlinks as mentioned here, you were able to get the applet
displayed on the browser?

Quite the opposite, as I tried to indicate in my original response,
restored above. In particular, after relinking, I can compile and run
applets with Java version 1.6. Such applets run fine in Applet
Launcher, appletviewer and my editor's HTML previewer; but they fail to
load in Safari 4.

I don't know if Safari 4 ignores the applet plugin settings in Java
Preferences, or if it is simply unable to use the 1.6 plugin.

By way of correction, I had set JAVA_HOME in ~/.bash_profile: export
JAVA_HOME=/Library/Java/Home. Omitting this export restores normal
operation of Java Preferences for the command line, obviating the need
for relinking.

Gotchas 2 & 3 remain unresolved.
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top