An old Java applet

[If you want to skip the story you can go straight to the applet page . There is also a link you can use at the end of this page.]

In the mid 1990’s Sun was promoting Java vigorously, especially with their “write once, run anywhere” assertion. It seemed that it would be a good idea to learn Java.

Needing a small simple project to get started, it occurred to me that there was a nice small program in the pbmplus set of image tools (now called NetPBM) that could be ported to Java, with one additional feature. The program is ‘ppmforge,’ written by John Walker, and it takes a number of parameter arguments and produces a random shaded planet against the stars of space (it can also make a plain star field, or clouds against a blue sky).

As a command line program, ppmforge writes its image to the standard output, or a file. The output image needs to be viewed with another program. So, it seemed a nice enjoyable starter project to port ppmforge to Java, and have the image immediately displayed in a Java AWT window.

I learned more than I expected, in particular that Java 1.0 had severe limits. A couple of procedures in ppmforge have numerous local variables, and these exceeded a surprising limit on automatic variable space in Java 1.0 (I forget the actual number). As a quick hack, many locals were moved into the class definition — given object scope — to get the Java program compiled.

In the end though, it worked out nicely and I could enjoy ppmforge’s planets without the trouble of using a separate viewer.

Encouraged, I soon added a Mandelbrot and Julia sets generator (much simpler than John Walkers planet generator); and not much later I had the notion that the program might be made into a controller for image generation modules, developed independently. This inspired the applet’s silly name ‘IForge’ — as in image forge (with a nod to ppmForge). Well, that never happened.

At first I only had a MSWindows 95 system to work with, but in March 1997 I installed my first Unix-like system in the form of Slackware GNU/Linux. Of course, it wasn’t long before I tried this “write once, run anywhere” program on Linux, and I was deeply disappointed. With ridiculous effort over weeks of spare time I got it running on both MSWindows and Linux, but I’d had enough. That bit above about modules never happened.

Nevertheless, I made some more bugfixes, and with the arrival of the very different Java 1.1 I did just enough rewriting for that. I made it public on a couple of ISP websites from 1998-2001, and then starting in 2002 hosted it at a domain I had for a while (ehynan.com, I no longer have it, but it’s at the Wayback Machine). The latter was served from a computer in my home over a DSL link with slow outgoing speed. In spite of this, server logs and web searches showed it was being used in classes at schools like Princeton and Rochester Institute of Technology — but nobody ever contacted me to comment, report bugs, ask for improvements — anything. So when www.ehynan.com went away I wasn’t concerned with any disruption that might be caused.

I’m making the old applet in its old pages available here. Try it if you like, but be aware that the pages probably won’t be much use on mobile devices; moreover, they’re ugly. There are some small bugs running the applet in current Java, but no show-stoppers, and it still works. If the code is wanted, there’s a link on the page.

Enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *