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

后端 未结 24 957
北恋
北恋 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:56

    I have met the similiar issue. I would link to run Ant task fron Maven build and I got the issue. I have fixed it as bellow steps:

    • Make sure JAVA_HOME is set right. You can check it on Windowns in command line as: C:>echo %JAVA_HOME% Result would look like: C:\Progra~1\Java\jdk1.6.0_30\
    • Copy file tools.jar from %JAVA_HOME%\lib to lib directory of Maven.

    And it worked for me.

提交回复
热议问题