Ant build not working: unable to find a javac compiler

后端 未结 8 2401
故里飘歌
故里飘歌 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 05:56

    For eclipse

    • Right Click build.xml ---> Build path ---> configure buildpath ---> select libraries tab
    • click "Add library" ---> double click on [jre system library ] ---> environments ---> installed jres ---> Add ---> standard vm
    • click on directory ---> Browse upto jdk [C:\Program Files\Java\jdk1.7.0_01]
    • finish
    • change the selection jre to jdk ---> click ok
    0 讨论(0)
  • 2020-12-15 05:57

    When you have both JRE and JDK installed in your system, please make sure JDK comes first in your PATH variable.

    I think system scans the PATH variable from left to right, whatever comes first is taken into consideration.

    In my case (with LinuxMint ) I was getting the same error. When I added JDK in PATH variable before JRE , it solved my problem.

    0 讨论(0)
  • 2020-12-15 05:58

    When you click on the next button in the JRE Type window after selecting Standard VM you go to the next window named JRE Definition where you can find the Directory button.

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

    In windows, go to computer properties, advanced system settings, advanced, environment variables

    Add a system variable called "JAVA_HOME" set its folder to your JDK location in my case "C:\Program Files\Java\jdk1.7.0_51"

    Close command prompt, reopen it and it should work now.

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

    This worked for me. Even after adding tools.jar if it shows that javac not found. Click on run-> external tools configuration -> jre -> seperate JRE make sure points to jdk -> apply -> run And then run the build.xml file Jusy make sure in installed jre you are pointing to jdk location. Hope this helps

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

    Got this error in Ant command line on Windows 7 x64 system.

    Below change fixed the issue

    Installed JDK from Oracle servers and then added a new system variable JAVA_HOME with value C:\Program Files\Java\jdk1.8.0_131

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