0
Unable to locate the Javac Compiler in...Please ensure you are using JDK 1.4 or above and not a JRE

Solved 1 Answers 15 Views
I just imported a maven project from Git repository. I am getting below error while doing mvn clean install.

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
  C:\Program Files\Java\jre1.8.0_131\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.971 s
[INFO] Finished at: 2017-05-13T06:23:31Z
[INFO] Final Memory: 11M/137M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project bdt: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR]   C:\Program Files\Java\jre1.8.0_131\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

 

Kindly advise!

1 Answer

0
Best answer
It looks like you have missed setting the JAVA_HOME environment variable.

Go to environment variable setting and add JAVA_HOME and point to the directory where your JDK is installed.

In my case, my JAVA_HOME is set to

C:\Program Files\Java\jdk1.8.0_131
answered May 13 by anonymous
selected May 13 by SunilBhaskar

Kindly Register and join the community of software testing professionals.

Notice:

We have recently moved our Question and Answer site from the domain name www.MayurShah.in to https://softwaretestingboard.com/qna as per the feedback from visitors.

For complete history of major changes, you can go to History

Site Status

  • que
  • ans
  • com
  • ua
  • us
  • Questions 817
  • Answers 738
  • Comments 464
  • Unanswered 126
  • Unselected 414
...