System.exit in tutorial resource

The System.exit call in the FancyResource source seems a harsh way to
respond to an error, especially when that error is likely to be committed
by dumber newbies, such as I, using the sample code.

In my case, I renamed the "tutorials" directory to "tutorial" to
accommodate the many prehistoric utilities I still use that do not
recognize long file names.  As a newbie I had no idea that the string
passed to Class.forName had to match the class' package name.  While trying
to figure out where to place the class, I commented out the package
statement and placed the class in \JAVA\LIB.  The configuration screen
found the resource, failed the Class.forName call, and took down the
server.  The cause and effect might have been easy to find had I not run
the JAVAW version of the JVM, which suppresses all console messages.

Now wiser, I won't make this mistake again, at least not very often.
Still, putting such System.exit code in a sample application that is likely
to be copied, is a bad idea.  I betray my ignorance of Java by not knowing
whether there is a better way of preventing the malformed class from loading.

McKinley Systems
San Francisco

Received on Tuesday, 11 March 1997 23:06:15 UTC