developer | thinker | tinkerer

Ant Version 1.6.x vs. 1.7.x and Eclipse 3.3

I recently upgraded to Eclipse 3.3 and CFEclipe and have had no problems - until today.

I'm working on some example Ant scripts for an upcoming presentation - and kept getting an error when trying to do very simple builds using an INPUT task:

BUILD FAILED E:\workspace\helloworld\build.xml:30: jave.lang.NullPointerException

This was on a laptop on which I had just installed a fresh copy of Eclipse, Java and CFEclipse. What was frustrating was the same script ran fine on my desktop.

I did some digging and discovered my desktop Ant was still pointing to my old Eclipse 3.2 setup which used Ant 1.6.5!!


So I copied the old org.apache.ant_1.6.5 directory from my Eclipse 3.2 directory on my desktop to the laptop (I dropped it into the Eclipse 3.3 plugins directory) and changed the Ant classpaths to use the older version - my build file worked again!

To check / change your classpaths:

  • Window > Preferences
  • Expand Ant
  • Click Runtime
  • Select the Classpath tab
  • Expand the "Ant Home Entries (Default)

You will now see a list of .jar files.

The path should include - org.apache.ant.1.7.0.vXXXXXXXXX - you can simple select all of these - and click Remove. Then click Add External JARS... and select all the .jar files in the older 1.6.5 dir - C:\eclipse-3.3\plugins\org.apache.ant_1.6.5\lib.

Don't worry - when you click "Remove" you aren't deleting anything so you can always go back to the newer JAR versions...

I'm going to dig around and see if this is an Ant or Eclipse problem. The same scripts work fine using the 1.7.x version of command line ANT.

In the meantime this 'fix' will allow me to continue working on my presentation and have working examples!

Update: Quick update - I found a post on Project Kody which has a fix. Eclipse Europa (3.3.0) - Discovered odd behaviour with Ant input task.

Through experimentation I discovered that by setting Ant to run in the same JRE as the workspace the input task succeeded!

  1. Click Run
  2. Click External Tools
  3. Click Open External Tools Dialog
  4. Click the JRE tab
  5. Select "Run in the same JRE as the workspace"

Text Link Ads - Warning Eclipse 3.3 - Keybindings

More like this...