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

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

    When everything else is correct try the following

    1. Goto Window -> Preferences -> Ant -> Runtime -> ClassPath
    2. Expand Global Entries and check jdk tools available here.
    3. Add the required tools.jar from a specific version of java such as "C:\Program Files\Java\jdk1.6.0_45\lib\tools.jar"
    4. Now build and check the results.

    Note: Add tools.jar for the java compiler that you want to use and give preference to it by moving it up in the list of tools.jar when multiple tools.jar (java compilers) are present.

提交回复
热议问题