# "Unable to locate the Javac Compiler" when building with Eclipse

**URL:** <https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484>\
**Category:** Development\
**Tags:** java, eclipse\
**Created:** [July 16, 2015, 5:24am UTC](https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484 "2015-07-16T05:24:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![psin0609](https://talk.openmrs.org/letter_avatar/psin0609/32/5_5575768a8748004e209b776fc1b2916d.png) [@psin0609](https://talk.openmrs.org/u/psin0609)\
**Post date:** [July 16, 2015, 5:24am UTC](https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484/1 "2015-07-16T05:24:38Z")

</div>

```
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] OpenMRS
[INFO] openmrs-tools
[INFO] openmrs-test
[INFO] openmrs-api
[INFO] openmrs-web
[INFO] openmrs-webapp
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building OpenMRS 1.12.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ openmrs ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.1:create (default) @ openmrs ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] ShortRevision tag detected. The value is '6'.
[INFO] Executing: cmd.exe /X /C "git rev-parse --verify --short=6 HEAD"
[INFO] Working directory: D:\openmrs-core\openmrs-core-master
[INFO] Storing buildNumber: 0 at timestamp: 1436978170908
[INFO] ShortRevision tag detected. The value is '6'.
[INFO] Executing: cmd.exe /X /C "git rev-parse --verify --short=6 HEAD"
[INFO] Working directory: D:\openmrs-core\openmrs-core-master
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:parse-version (parse-version) @ openmrs ---
[INFO] 
[INFO] --- maven-jar-plugin:2.3.2:test-jar (default) @ openmrs ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: D:\openmrs-core\openmrs-core-master\target\openmrs-1.12.0-SNAPSHOT-tests.jar
[INFO] 
[INFO] --- license-maven-plugin:2.6:check (default) @ openmrs ---
[INFO] Checking licenses...
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ openmrs ---
[INFO] Installing D:\openmrs-core\openmrs-core-master\pom.xml to C:\Users\Piyush\.m2\repository\org\openmrs\openmrs\1.12.0-SNAPSHOT\openmrs-1.12.0-SNAPSHOT.pom
[INFO] Installing D:\openmrs-core\openmrs-core-master\target\openmrs-1.12.0-SNAPSHOT-tests.jar to C:\Users\Piyush\.m2\repository\org\openmrs\openmrs\1.12.0-SNAPSHOT\openmrs-1.12.0-SNAPSHOT-tests.jar
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building openmrs-tools 1.12.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ openmrs-tools ---
[INFO] Deleting D:\openmrs-core\openmrs-core-master\tools\target
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.1:create (default) @ openmrs-tools ---
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:parse-version (parse-version) @ openmrs-tools ---
[INFO] 
[INFO] --- maven-resources-plugin:2.4:resources (default-resources) @ openmrs-tools ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.1:compile (default-compile) @ openmrs-tools ---
[INFO] Compiling 1 source file to D:\openmrs-core\openmrs-core-master\tools\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
  C:\Program Files\Java\jre7\..\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] 1error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] OpenMRS ............................................ SUCCESS [2.541 s]
[INFO] openmrs-tools ...................................... FAILURE [0.422 s]
[INFO] openmrs-test ....................................... SKIPPED
[INFO] openmrs-api ........................................ SKIPPED
[INFO] openmrs-web ........................................ SKIPPED
[INFO] openmrs-webapp ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.312 s
[INFO] Finished at: 2015-07-15T22:06:12+05:30
[INFO] Final Memory: 19M/355M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project openmrs-tools: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre7\..\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] -> [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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :openmrs-tools

```

any one familiar to these errors please respond…!

---

<div class="post-metadata">

**Author:** ![k.joseph](https://talk.openmrs.org/user_avatar/talk.openmrs.org/k.joseph/32/8097_2.png) [@k.joseph](https://talk.openmrs.org/u/k.joseph)\
**Post date:** [July 16, 2015, 5:35am UTC](https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484/2 "2015-07-16T05:35:59Z")

</div>

> [@psin0609](#):
>
> [ERROR] Unable to locate the Javac Compiler in:

Looks like your java is not set up well. You need to set up JAVA\_HOME and add the java compiler to your PATH after installing java jdk.

I see you instead have jre under C:\Program Files\Java which most jdk packages install anyway. See:

> <https://stackoverflow.com/questions/12585380/maven-unable-to-locate-the-javac-compiler-in>

---

<div class="post-metadata">

**Author:** ![psin0609](https://talk.openmrs.org/letter_avatar/psin0609/32/5_5575768a8748004e209b776fc1b2916d.png) [@psin0609](https://talk.openmrs.org/u/psin0609)\
**Post date:** [July 16, 2015, 8:57am UTC](https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484/3 "2015-07-16T08:57:06Z")

</div>

after configuring the build path and building the project again i am getting this error

```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project openmrs-tools: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] javac: invalid target release: 1.8
[ERROR] Usage: javac <options> <source files>
[ERROR] use -help for a list of possible options
[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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :openmrs-tools
```

---

<div class="post-metadata">

**Author:** ![pascal](https://talk.openmrs.org/letter_avatar/pascal/32/5_5575768a8748004e209b776fc1b2916d.png) [@pascal](https://talk.openmrs.org/u/pascal)\
**Post date:** [July 16, 2015, 9:07am UTC](https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484/4 "2015-07-16T09:07:23Z")

</div>

If you’re trying to build master, then you need Java 8.

> [@psin0609](#):
>
> javac: invalid target release: 1.8

This message implies you’re using a Java version \< 8.

---

<div class="post-metadata">

**Author:** ![psin0609](https://talk.openmrs.org/letter_avatar/psin0609/32/5_5575768a8748004e209b776fc1b2916d.png) [@psin0609](https://talk.openmrs.org/u/psin0609)\
**Post date:** [July 16, 2015, 1:52pm UTC](https://talk.openmrs.org/t/unable-to-locate-the-javac-compiler-when-building-with-eclipse/2484/5 "2015-07-16T13:52:13Z")

</div>

problem solved. and now i am using it. thanks pascal and k\_joseph
