Ant build not working: unable to find a javac compiler

后端 未结 8 2402
故里飘歌
故里飘歌 2020-12-15 05:46

I am trying to run some Java EE examples. Ant is suggesting: Perhaps JAVA_HOME does not point to the JDK. It is currently set to \"C:\\Program Files\\Java\\jre7

相关标签:
8条回答
  • 2020-12-15 06:16

    I was getting the same error in Mac OS X but all the answers I could find were for the Windows system and as the paths are a little different in both, those solutions weren't working for me. After spending hours on it, I was finally able to fix it in the following way:

    Copy /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/tools.jar to /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext

    It will work for Windows users too:

    Copy C:\Program Files\Java\jdk1.8.0_91\lib\tools.jar to C:\Program Files\Java\jre8\lib\ext

    P.S. Also take care that the versions for jdk and jre that you have selected in Eclipse are compatible.

    0 讨论(0)
  • 2020-12-15 06:18

    Quick work around for the same is

    Copy C:\Program Files\Java\jdk1.7.0_03\lib\tools.jar to C:\Program Files\Java\jre7\lib\

    This exception is coming because JAVA_HOME is being set as C:\Program Files\Java\jre7 and Ant is not able to find tools.jar in it.

    0 讨论(0)
提交回复
热议问题