I’m trying to compile my project with “ant build”, but I’m getting this error:
Unable to locate tools.jar. Expected to find it in
/usr/lib/jvm/java-6-openjdk/lib/tools.jar
I searched tools.jar and it is just in /usr/lib/jdk1.7.0_01/lib/tools.jar.
Is a good idea to create a symlink like this below?
ln -s /usr/lib/jdk1.7.0_01/lib/tools.jar
/usr/lib/jdk1.7.0_01/lib/tools.jar
Well.. actually I tried to create that symlink, but then I’m getting this error:
BUILD FAILED /home/me/code/StockWatcher/build.xml:29:
java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main :
Unsupported major.minor version 51.0
So I don’t know if this last error is because the symlink…
Javi
No creating the symlink is not a good idea (mixing two JDKs)
Ant is using the same Java version used to run Ant itself. If you want to use Java 1.7 you should instruct Ant. From the
javacTask documentation:If you want to use the same Java version as Ant be sure that you installed it correctly (and that you installed the JDK and not only JRE)