Why does ANT tell me that JAVA_HOME is wrong when it is not?

后端 未结 24 946
北恋
北恋 2020-12-07 16:49

I get the error:

C:\\dev\\ws\\springapp\\build.xml:81: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not

24条回答
  •  自闭症患者
    2020-12-07 16:57

    Actually found this answer on superuser.com, but I had to copy tools.jar from my JDK\lib directory to the JRE\lib directory.

    Makes ZERO sense...only thing I can think of is Sun introduced this bug in the latest Java runtime (Java 7 Update 11) or a bug in Ant in how it reads the current JDK location (the JRE is more updated than the JDK obviously which is also stupid of Sun...they should release the JDK each time they update the JRE).

    My JAVA_HOME was set correctly. I confirmed by doing "set JAVA_HOME". It pointed to my JDK directory and was spelled correctly. However, Ant was claiming it couldn't find javac, but thought JAVA_HOME was in my JRE directory.

    My system worked fine before the latest Sun JRE7 updates (10 and 11). Ant is version 1.8.4

提交回复
热议问题