Search code examples
javaeclipseant

Eclipse: changing runtime Ant Home results in error popup regarding missing tools.jar library


I was trying to change the runtime Ant version of my Eclipse IDE (Helios) from the outdated version built-in with Eclipse to the more robust and latest version saved elsewhere on my computer (Windows XP Professional). In order to do this change, I had to go to Window -> Preferences -> Ant -> Runtime -> Classpath and then change the Ant Home to the home directory of the newer Ant version. This results in the following yes-no popup message:

The specified Ant runtime classpath does not include a tools.jar library. This may affect the ability to use various tasks. Ignore this possible problem?
Even reverting back to the original built-in directory for _Ant Home_ results in the same popup warning message. In addition, my Ant build.xml script runs just ok despite this warning.

I know there are some other SOF questions that state covers a similar problem: an error message during an Ant build script execution because tools.jar is missing. These questions seems to relate to a JAVA_HOME variable problem (relevant question). Is this what Eclipse was trying to warn me about? Or is this warning about something different? I believe I have ANT_HOME and JAVA_HOME variables set up properly on my computer.


Solution

  • The warning means your Java Setting under Window > Preferences > Java > Installed JREs points to JRE instead of JDK.
    All your ant stuff will work fine with the exception of the javac task which needs the tool.jar
    Either use :
    Window > Preferences > Ant > Runtime > Classpath and add the tools.jar from your JDK installation
    or
    change the settings under Window > Preferences > Java > Installed JREs from JRE to JDK
    to bring the tool.jar into the game.