i have a project that uses ivy to manage its dependencies. i'm implementing a feature to the project that requires me to include tools.jar. however, because tools.jar is platform dependent, i'm trying to use ivy to resolve to a local file for the artifact. i'm doing the following:
<dependency org="com.sun" names="tools" rev="1.6.0">
<artifact name="tools" type="jar" url="file:///${java.home}/../lib/tools.jar"/>
</dependency>
that should retrieve the file from the local ${java.home}/../lib/tools.jar. (note: java.home points to the JRE installation).
however, there are problems resolving the location. on my windows machine, it seems to think "c" is the protocol (c is coming from ${java.home}. and i'm sure that my url is defined correctly because "file:///C:/foo" is the correct way to specify a url to a file (3 slashes). the problem i see is that it strips off 2 slashes and tries "file:/C:..." instead of "file:///C:.." as i specify above. i also tried specifying the path to the file directly w/o the ${java.home}
i would like to keep this approach retrieving through ivy, but i can't get it to work. any ideas?
JAVA_HOME needs to point at the location of your JDK, not your JRE. Once you change this, ANT will stop complaining about a missing tools jar.
Looking at the path you provide above, I suspect that you already have a JDK installed....
Analysis
On my system the tools jar is located here:
Oddly, and confusing, the Java JDK ships with a JRE inside