Skip to main content

A Bundle of Joy - NOT.

Posted by cayhorstmann on August 2, 2007 at 10:48 AM PDT


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



bundle of joy movie style="float:left; margin-right: 1em;" /> When JDK 6 was released, there
was a lot of buzz about the bundling of Derby, erm, JavaDB: href="http://coffeecode.net/archives/107-Java-6-is-out;-now-including-JavaDB-aka-Apache-Derby.html">buzz,
href="http://weblogs.java.net/blog/forsini/archive/2006/06/java_db_is_now.html">buzz,
href="http://weblogs.java.net/blog/davidvc/archive/2006/06/java_db_is_bund.html">buzz.
Of course, there also was some href="http://www.bileblog.org/?p=25">bile. Programmer opinion was href="http://today.java.net/pub/pq/109?page=last&x-maxdepth=0">mixed.
My personal feeling (recorded href="http://today.java.net/cs/user/view/cs_msg/20360">here for
posterity) was “Doesn't the Java team have better things to
do?”

But so what—once the deed was done, I felt that I might as well
take advantage of the bundled database. In a couple of books, I suggested
that readers download JDK 6 and put jdk/lib/db/derby.jar
onto the classpath. The publisher of my href="http://horstmann.com/bigjava">college text developed a nifty
tool for homework checking that is deployed with Java Web Start. It allows
students to run sanity checks on their homework assignments, and it
uploads the solutions and the results of the checks to the professor's
gradebook. For database problems, it simply uses
jdk/lib/db/derby.jar.

All was peachy until Java SE 6u2. ( href="http://weblogs.java.net/blog/cayhorstmann/archive/2007/07/number_melancho.html#comments">Don't
get me going on the numbering...)

Now, out of a sudden, the href="http://java.sun.com/javase/6/webnotes/README.html#javadb">rules have
changed. According to Sun,

“This distribution bundles Java DB, Sun Microsystems'
distribution of the Apache Derby pure Java database technology. Default
installation locations are:

  • Solaris: /opt/SUNWjavadb
  • Linux : /opt/sun/javadb
  • Windows: C:\Program Files\Sun\JavaDB

The reality is a bit more complex.

On Linux, JavaDB is no longer included in the Sun JDK download. It may
be that they hope that Ubuntu and others add it to their package, but
Ubuntu doesn't even use the /opt directory.

On Windows, the installer charmingly continues making the
jdk/lib/db directory, but it leaves it empty. Users can
select where they want JavaDB installed (with C:\Program
Files\Sun\JavaDB
as the default). You can find their decision in the
registry (HKLM\Sun Microsystems\JavaDB). Except that the
uninstaller doesn't remove the registry entry, so you don't want to rely
on it.

I have no idea what Apple does with their JDK for the Mac, but I would
love to know.

The takeaway from this sorry episode is:

  • Don't rely on JDK users having JavaDB. They may or may not have it,
    and if they do, it is a nightmare to locate it.
  • If you write an article or book, just tell your readers to download
    Apache Derby.
  • The lesson from Sun's blunder is: Don't bundle unless (a) there is a
    truly pressing need and (b) you have the resources to do it right. A
    bungled bundle is worse than not bundling in the first place.