Java with apt-get, what's the scoop?
So the big news of the previous week was the availability of Java packages with the latest Ubuntu 7.04 (Faisty Fawn). I won't repeat what others already said, but now you can install Sun Java implementations with the standard Ubuntu tools for application maintenance (apt-get, Synaptic package manager, etc...).
It took a bit for me to upgrade my computers. The triple-boot Mac-Mini was successfully updated from Dapper to Edgy, but at this point the updater gets stuck. Two old true Intel PCs were successfully updated, but with some troubles (mainly related to the lack of disk space on the
/boot partition and such). My MacBook Pro, that already started with Edgy, was updated fine - too bad that Faisty Fawn screwed up my WiFi configuration and now generates spurious mouse click events (this is very annoying since it's continuously screwing up my text as I'm typing - but it's anything that can't be fixed later, probably by installing a specific driver).
In the end, I've done it. So what? All this fatigue just for the pleasure of installing the JDK with
apt-get instead of downloading the tar and extracting it?For developers this could change just a bit. For deploying your Java applications this is an important step forward.
For instance, I've quickly packaged blueMarine as a
.deb distribution (beware: it's just a first try, there are still details to refine). Packaging a
.deb distribution just means to reproduce on a working folder the final layout of files (for instance I choose to place all the blueMarine stuff under
/usr/local/blueMarine and the launcher under
/usr/bin/blueMarine), adding a "control" file such as the following:
Section: non-free/net Priority: extra Maintainer: Tidalwave s.a.s.
Package: blueMarine Version: 0.9.EA9SNAPSHOT.1738 Installed-size: 12345678 Architecture: all Depends: sun-java5-jre (>= 1.5.0) Provides: blueMarine Description: open source application for the photographic workflow
and running a special command:
sudo dpkg -b work/ blueMarine_0.9.EA9SNAPSHOT.1738_all.deb
To install the application you just need to do:
sudo dpkg -i blueMarine_0.9.EA9SNAPSHOT.1738_all.deb
Now, to me there are two important points.
First, in the control file I could declare an explicit dependency on the Sun Java JRE distribution. This means if I try to install my application in a system where Sun JRE has not been installed, I get the following error messages and the user is notified about the required missing packages:
fritz@Scirocco:~/Desktop$ dpkg -i blueMarine_0.9.EA9SNAPSHOT.1738_all.deb dpkg: requested operation requires superuser privilege fritz@Scirocco:~/Desktop$ sudo dpkg -i blueMarine_0.9.EA9SNAPSHOT.1738_all.deb Password: Selecting previously deselected package bluemarine. (Reading database ... 107651 files and directories currently installed.) Unpacking bluemarine (from blueMarine_0.9.EA9SNAPSHOT.1738_all.deb) ... dpkg: dependency problems prevent configuration of bluemarine: bluemarine depends on sun-java5-jre (>= 1.5.0); however: Package sun-java5-jre is not installed. dpkg: error processing bluemarine (--install): dependency problems - leaving unconfigured Errors were encountered while processing: bluemarine
Second, as the .deb-packaged JRE is installed in a well-known directory (e.g.
/usr/lib/jvm/jre-1.5.0-sun), I could explicitly point to it in the launcher script of blueMarine:
#!/bin/sh export JAVA_HOME=/usr/lib/jvm/jre-1.5.0-sun ... $JAVA_HOME/bin/java -cp ...
In this way there's no more the risk of having my application launched with the GNU's Java Virtual Machine, a thing that causes sure troubles since it's not truly compatible with Java, but unfortunately advertises itself as Java, so usually people complains with my application rather than with the distro. Of course, I can also be sure that my application will be now launched with the proper JRE version. And I'm not forced to fix these troubles by bundling yet another JRE with my application, thus creating a possible proliferation of JREs in the user's disk.
After the Sun JRE is installed, the
blueMarine launcher is in the path and can be just typed from a console to run the application. So now blueMarine is a first-class citizen in Ubuntu!
Not everything has been fixed yet, and this post is just introductory. I plan to write a more extensive description within a few days, when everything is complete (and the process of creating the distribution has been possibly automated); also I'd like to understand whether it's possible to have blueMarine appear in the system menus etc.
In the meantime, feel free to ask questions or to add some points if you're expert at creating Debian packages.
PS1 I already have a question: what happens with other Linux distributions? Are they all compatible with
PS2 I've uploaded the blueMarine_0.9.EA9SNAPSHOT.1738_all.deb for trying, just remember that it's an untested snapshot, I mean I don't guarantee does something clever after the installation ;-)