Java problems

I can’t seem to get stupid Java scripts to run on either my IE 5.0 browser or Netscape 4. I operate on a Macintosh G3 laptop (250 MHz… the first model that came out, methinks.) I have Apple MRJ enabled in the Preferences file. And I just installed MRJ 2.1.4 after getting messages saying that the Java that was installed on my machine (2.0 or maybe even earlier) had gone the way of the Vic-20.

So, this is what happens. In Netscape I get an error that says something like “Applet Error:Wrong Magic Number.” WTF does this mean. Magic number?

And in Explorer, it’s even less helpful…says “Applet Error: Closing”

Sifting through the Java Messages on IE5, there seems to be a bunch of “Class Not Found Exception.” Also something about a Null Pointer Exception.

Here’s a piece of it

What in the world is going on here? I’ve never had Java work properly on my computer. I just installed the newest one, and it still don’t work. I’m sure it’s something really obvious and stupid that I’ve missed, but I’m at wits end trying to figure out what it is.

Help…

Sounds like you have some invalid java classes. Magic numbers are the parts at the beginning of certain files that identify what type of file it is. So perhaps it’s finding some .class files that are not really .class files! Try removing everything Java related from your system. Be very, very thorough. Do a search for .class, .jar, or .zip and you shouldn’t find anything. Then re-install. This may help.

There’s an option with IE to repair the files. If you go to control panel and add/remove programs, once you choose IE to uninstall, it’ll give you the option to repair. Try that. You might as well upgrade to IE 5.5 instead, though, to see if that fixes any of your probs.

Crap, just realized you said Mac. That option might still be available, but again, you might as well install 5.5.

If you don’t have any luck with that, you might try the forums at freejavahelp.com

Actually, MRJ 2.2.4 is the current version, but I don’t know what version of the OS you’re running so I don’t know if it’s appropriate for you.
What I believe you have encountered is not Java, but MS-Java. You have found a web page designed with Microsoft Java programming tools, and is incompatible with non-MS operating systems and browsers. They did this deliberately, and Sun sued them for deliberately “polluting” Java. Sun won, and now MS can no longer pull this kind of bullshit. You say you never had Java working properly on your Mac, and this is why. BillG decreed that his Java would be broken on any platform except Microsoft Windows.
It would help if you could provide the URL to the offending site so I could check it out. If you don’t want to post it in public, click on my SDMB profile to get my address and email it to me.

There is no IE 5.5 for Mac yet. They haven’t even finished 5.1 yet. MS products for the Mac are “self-healing” and should not require manual repair.

My bad, it’s MRJ 2.2.4. that I have installed. I am running OS 8.5.1 on this machine.

As for the sites, well, it’s pretty much any Java site. The Sony site for Jeopardy on-line, the encyclopedia britannica Java links for chess games.

Here’s the britannica link:
http://www.britannica.com/eb/article?eu=137009

I’m just curious whether my having folders of the old MRJs around are somehow causing problems. I don’t know why this would be, just throwing it out there.

Just as a point of reference - that applet doesn’t work on this machine either: PC running Win2000, Netscape browser. JDK1.3 from JavaSoft installed for use with Forte for Java. Similar classloader error.

This is why I dislike applets. Entirely too likely that you will get mismatched classes because you have too little control over the environment on the client machine.

Calling it a “magic number” is a bit misleading. That term is usually used for a number used to verify a file type. If I come up with a binary file format, for instance, I may place 666 in, say, bytes 32 - 35 of the file so that if I don’t find it there when I read the file I know I’ve got ahold of the wrong type of file.

These are a bit more, although it is a number buried in the .class file, hence the use of the term. Java classes come with id numbers, a different individual number for each class. There are utilities for changing the id numbers to indicate that you have produced a different version of the class. Classloader errors like this happen when the expected id numbers for classes don’t match - the downloaded applet wanted id #1000213 of some particular class, and picked up some other version from your environment. Mine, too, apparently.

Avoid applets like the plague, or restrict their use to very small self contained things (90% of which could have been implemented with javascript anyway) or to environments like corporate intranets where you can decree the sort of environment the users will have on their machines.

I don’t have a lot of experience with misbehaving operating systems and browsers but I’ve got a lot of experience with misbehaving Java code. In my experience the reason for a ClassNotFoundException in Java is almost always due to classpath problems. Either the classpath the browser is using isn’t pointing to the right place or the class is missing altogether. I don’t think the class loader is even getting far enough to check the version of the class, but I wouldn’t bet the farm on that.