Tuesday, June 19, 2007

Configuring Ant in Linux

I solved this problem a couple of years ago, but now it popped up again and I had forgotten how to solve it and wasted some time. So for my own sake, and in case people are Googling for it:

If you get
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
when running ant first of all run "which ant" and "which java" to see which programs are being executed. You might discover (like I did) that the server is running an old gcj and there is an old systemwide ant. Export ANT_HOME, JAVA_HOME to correct the dirs. Also
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

If you STILL get NoClassDefFoundError, you might find that there is a
file which trips you up, you might have to set ANT_HOME and JAVA_HOME properties there too! Or like Michael-N suggests, run ant --noconfig -version

The best solution though, tends to be to uninstall gcj, as well as all old system wide java tools that came with your distro. Instead of using RPM or similar, download the latest source directly from Sun. Things might improve now that Java is open source though.

Saturday, June 9, 2007


So I finally gave in and got a real blog, where I previously only had a few random Slashdot journal entries. Blame this guy! On a serious note, what convinced me was his argument that already today many in the computer industry find good blogs a more useful indication of a persons skill and history than does a CV or a long list of certifications. I like my current job, but I suppose I will switch some day, so I might as well get started.