Couldn't find javac

I am trying to get an automated system to run a video game minigame. I have to compile it myself, and after after THERE IS A USER, I get this when I run build.xml with ANT. Below is the code and the error in it.


Buildfile: C:\Users\Arm\workspace\DarkBot\build.xml
init:
clean:
   [delete] Deleting directory C:\Users\Arm\workspace\DarkBot\bin
 compile:
    [mkdir] Created dir: C:\Users\Arm\workspace\DarkBot\bin

BUILD FAILED
C:\Users\Arm\workspace\DarkBot\build.xml:21: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files (x86)\jre1.8.0_25"

      


What am I doing wrong? Also I can assure that JAVA_HOME is pointing to the correct scope, as suggested in the error message.

+3


source to share


4 answers


JRE is not equal to JDK.

  • JRE stands for Java Runtime Environment, which is used to run Java programs.
  • JDK stands for Java Development Kit which is used for Java COMPILE programs; it includes javac

    a Java compiler.


Install JDK and dots JAVA_HOME

to fix location to fix the problem.

+2


source


Install JDK , JDK will compile your program and have javac in bin folder like this "C: \ Program Files \ Java \ jdk1.7.0_51 \ Bin".

Set your path in environment variables either in the system variable "path" or as "JAVA_HOME"



you can try Uninstall and reinstall the already installed one.

+1


source


All materials ant will work fine, except for the problem the javac , which needs to be tools.jar

located in the / lib directory of the JDK

, JRE

in this case, is not enough.,

eclipse setting

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


source


If you cannot find the path after testing on the command line and it says something like "java error not found or it is not available from internal or external ....." then follow these steps:

Go to C: \ Program Files \ Java \ jdk1.7.0_76 \ bin , which shows the location of your java container in the specified path.

Go to My Computer> System Properties> Advanced Options> Click on Environmental Variables> (check this closed ... in the second section of the window where it says System Variables, scroll down until find the "path" on the left)

click "path" found in the list of system variables and click "edit".

Now paste the copied link into my case C: \ Program Files \ Java \ jdk1.7.0_76 \ bin

Click OK and go back to Command Prompt and test it. Hope this helps as my work is now.

0


source







All Articles