Installing Apache Harmony on Debian
What’s Apache Harmony? It’s an open source Java SE implementation with an unclear future. But, please, don’t ask me ‘Why installing it?’ Because developers are curious creatures😉
I don’t like to install a software distributed as a tar.gz archives. If it is possible, I’ll use my distribution’s native packages. It turned out that Apache Harmony project provides prebuilt packages for Debian/Ubuntu. So you have to download packages one by one and just install with
dpkg --install harmony-5.0-jre_0.0r991518-1_i386.deb.
There is nothing wrong if you’re interested in a one-time installation but there are manual actions required when (and if) Harmony project provides updates:
- you have to be notified somehow about the fact that a new version is available;
- you have to download a number of packages one by one;
- you may have to (semi)manually resolve missing dependencies.
As my motto says,
less work for humans, more work for machines. just as it should be
so let my machines do some more work😉
Make packages’ location known to APT
Add these two lines to
deb http://mirrors.ibiblio.org/pub/mirrors/apache/harmony/milestones/6.0/debian/i386/ ./ deb http://mirrors.ibiblio.org/pub/mirrors/apache/harmony/milestones/5.0/debian/i386/ ./
and update the list of available packages with
For most Apache projects, all links on the download page point to the best mirror site based on your location, and Harmony’s Project Downloads page is no different. It suggested http://apache.vc.ukrtel.net/ as the best mirror site for my current location and, unfortunately, files mirrored to
/harmony/milestones/6.0/M3/debian/i386. Chances are that the next milestone builds will be stored in other directory like
/harmony/milestones/6.0/M4/debian/i386 and I have to touch
sources.list. I think that layout provided by mirrors.ibiblio.org doesn’t have these drawbacks but only time will tell.
Installation is as simple as running
aptitude install harmony-5.0-hdk harmony-6.0-hdk.
Check what’s installed
Let’s check what we have for main two executables,
update-alternatives --display java:
java - manual mode link currently points to /usr/lib/jvm/java-6-sun/jre/bin/java /usr/bin/gij-4.4 - priority 1044 /usr/bin/gij-4.5 - priority 1045 /usr/bin/java-harmony - priority 30 slave java.1.gz: /usr/share/man/man1/java-harmony.1.gz /usr/bin/java-harmony-6.0 - priority 30 slave java.1.gz: /usr/share/man/man1/java-harmony-6.0.1.gz /usr/lib/jvm/java-1.5.0-sun/jre/bin/java - priority 53 slave java.1.gz: /usr/lib/jvm/java-1.5.0-sun/jre/man/man1/java.1.gz /usr/lib/jvm/java-6-openjdk/jre/bin/java - priority 1061 slave java.1.gz: /usr/lib/jvm/java-6-openjdk/jre/man/man1/java.1.gz /usr/lib/jvm/java-6-sun/jre/bin/java - priority 63 slave java.1.gz: /usr/lib/jvm/java-6-sun/jre/man/man1/java.1.gz Current 'best' version is '/usr/lib/jvm/java-6-openjdk/jre/bin/java'.
update-alternatives --display javac:
javac - manual mode link currently points to /usr/lib/jvm/java-6-openjdk/bin/javac /usr/bin/ecj - priority 143 slave javac.1.gz: /usr/share/man/man1/ecj.1.gz /usr/bin/gcj-wrapper-4.5 - priority 1045 /usr/bin/javac-harmony - priority 30 slave javac.1.gz: /usr/share/man/man1/javac-harmony.1.gz /usr/bin/javac-harmony-6.0 - priority 30 slave javac.1.gz: /usr/share/man/man1/javac-harmony-6.0.1.gz /usr/lib/jvm/java-1.5.0-sun/bin/javac - priority 53 slave javac.1.gz: /usr/lib/jvm/java-1.5.0-sun/man/man1/javac.1.gz /usr/lib/jvm/java-6-openjdk/bin/javac - priority 1061 slave javac.1.gz: /usr/lib/jvm/java-6-openjdk/man/man1/javac.1.gz /usr/lib/jvm/java-6-sun/bin/javac - priority 63 slave javac.1.gz: /usr/lib/jvm/java-6-sun/man/man1/javac.1.gz Current 'best' version is '/usr/lib/jvm/java-6-openjdk/bin/javac'.
What about more deatiled verson information?
/usr/bin/java-harmony -version reports:
Apache Harmony Launcher : (c) Copyright 1991, 2010 The Apache Software Foundation or its licensors, as applicable. java version "1.5.0" Apache Harmony (1.5.0) DRLVM (1.5.0-r991518) pre-alpha : not complete or compatible svn = r991518, (Sep 7 2010), Linux/ia32/gcc 4.3.2, release build http://harmony.apache.org
Apache Harmony Launcher : (c) Copyright 1991, 2010 The Apache Software Foundation or its licensors, as applicable. java version "1.6.0" Apache Harmony (1.6.0) DRLVM (1.6.0-r991881) pre-alpha : not complete or compatible svn = r991881, (Sep 8 2010), Linux/ia32/gcc 4.3.2, release build http://harmony.apache.org
- No alternatives for
What is the Debian alternatives system:
The Debian alternatives system creates a way for several programs that fullfill the same or similar functions to be listed as alternative implementations that are installed simultaneously but with one particular implementation designated as the default.
It’s a minor issue, though.
- Both Harmony 5 and 6 use the same Java compiler
/usr/bin/javac-harmony-6.0 -versionreport exactly the same version of the compiler:
Eclipse Java Compiler 0.972_R35x, 3.5.1 release, Copyright IBM Corp 2000, 2009. All rights reserved.
It seems to me as a quite serious issue, but what roadblocks to expect when cross-compiling and using different versions of compilers is a topic for another post.
I don’t have enough time to play with, so there are not so much to say, except: Apache Harmony installs, works in some cases, and may be uninstalled with ease.