Java Bugs

(with Akkana's Java programs -- this is not a page offering to help you debug your own Java applets.)

Can't get one of my Java programs to work? Yeah, there are lots of known bugs in various implementations of Java. I am specifically not an expert on how to get Java to run on Windows -- I'm not a Windows user myself (if you're having trouble getting Java installed on Linux I might be able to help). Please don't contact me with generic "Java doesn't work for me at all" problems. This page is here for people who have Java working in their browsers for other applets, but there's a bug with one of mine.

First, a couple of important rules of bug reporting: if you send me a bug report, please tell me:

This may seem obvious, but you wouldn't believe how many people send me email saying "Java doesn't work, why not?" with no more information than that.

One other thing: please do not send me mail asking why your java applet doesn't work, or asking me to debug your applet. I am not a java applet expert. In fact, I've mostly given up on writing applets because there are so many problems with them.

If you get a "Can't parse date" error, perhaps Java isn't understanding your system time zone.

The core of the problem is that Windows 3/95/98 has several different ways of expressing time zone, and Sun's Java engine (which is used by both Netscape and Microsoft) only understands one of them, the one that uses three-letter abbreviations like "PST". So if the date string includes anything that looks like "Pacific Standard Time", that's your problem, and you either have to set up your system to set the TZ variable (see discussion of the timezone bug for details on how to set it). Also, Java doesn't understand all time zones (e.g. it doesn't understand HST); users outside the four timezones of the contiguous US may have to use GMT instead.

Or try editing the date field and typing in a date in a format like: Dec 2 13:00 GMT 1997 and see if that helps. If it doesn't, if you send me mail to try to figure out what's wrong, be sure to include the string from the date field of the applet, otherwise I won't be able to guess why it can't parse it.

Time Zone Bug warning! If your system is currently using daylight savings time, there is a bug in the Java engine of some web browsers which incorrectly adds 1 to the date typed in, even if you specify daylight savings time (e.g. "PDT") or UTC in the date string.
To test whether your system has this bug, try the date: "Sep 9 22:45 PDT 1997". The GRS and Io's shadow should be on the meridian at this time. If you have to specify 23:45 to see them on the meridian, then you'll have to specify times 1 hour later than the times you really want. I'm working on finding a way for the applet to detect this automatically.

(I don't know if that bug still exists now. I would hope, more than ten years later, that it's long since been fixed.)

Don't see anything at all?
Sounds like Java didn't run at all. We need to find out why. Take a look at the Java Console (maybe in the Windows or Options menu, depending on which browser you're using). The Java console is where Java errors get printed. These errors will probably be very cryptic and nonsensical if you're not a Java hacker, and the error message reported is almost never really what the problem is, but sometimes they really do provide useful clues as to what the real problem is.

So if you don't see anything at all, please copy-n-paste the error from the Java console, and mail it to me along with information on what browser you're running, what version, and on what platform and OS (e.g. Linux, PC/Windows XP, Mac/68k, SGI/IRIX 6.2, etc.) and we'll take it from there.

Trying to run the Star Chart applet and it seems like it might be starting up, but then it suddenly dies and the Java console shows some kind of bizarro security violation error or something?

First guess: are you by any chance running this from inside a company, behind a company firewall? Netscape has some known problems with this (I'm not sure about IE, I've never heard from an IE user who's run this applet from behind a firewall). Basically, the problem is that the DNS proxy in the firewall isn't recognized by Java as the same host from which the applet was loaded, and trying to contact any other host generates a security violation. Bummer!

There are several workarounds, most of them not pretty:

I would very much like to know whether Netscape 4.0 solves this problem, but I no longer have access to any machines behind firewalls so I can't test it. Please, someone behind a firewall, download 4.0b5 or greater, try it and let me know if it works!
Trying to run the Jupiter applet or the phase of the moon applet, and you see a grey square with a date underneath it?

I bet you're on a Mac, right? There's apparently a bug in the Java engine on Mac 3.01 Netscape which causes the initial redraw not to work right. If you click around the image and fiddle with scrollbars and maybe move another window on top of the browser window then uncover the browser window again, eventually I'm told that it wakes up and draws and then after that everything is fine. I don't understand yet exactly what is going on here.

Trying to run the Jupiter applet or the phase of the moon applet, and everything looks like it's working but the position of Jupiter's moons is an hour off?

It seems that the Java engine from Sun which everyone has been using all these years has a major bug in timezone handling, on every platform (but it's worst on Windows if you don't have your TZ environment variable set). Turns out that the Java engine decides to add the hour for daylight savings time based on whether the operating system thinks it's currently daylight savings time, having nothing to do with whether the time string says "PDT" or not. You can't even work around this by specifying GMT -- it'll still convert to daylight savings time. Worse, when it asks the system for the current time, it may not interpret the answer correctly, and may end up thinking there was an error in the time specifier, and not draw anything.

On Windows 95 or 98, if it's daylight savings time and I edit the "PDT" in the time string to say "PST" instead, the satellite positions become correct. Of course this requires setting the time zone if it isn't already set (on W98 it probably will be).

Back to Akkana's Home Page
Back to Akkana's Astronomy Page
mail comments