Hurry! Try our new Interactive Courses for FREE. 🥳   🚀
  Signup/Sign In
Not satisfied by the Answer? Still have doubts?
Ask Question

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

I'm compiling a project in Eclipse using m2eclipse. I set the JDK path in Eclipse like this:

Windows-->preferences-->installed jres--> jdk1.7.xx path
But this is showing an error

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.424s
[INFO] Finished at: Tue Oct 29 15:21:01 IST 2013
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler- plugin:3.1:compile (default-compile) on project TEST-WEB: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
maven eclipse java
by

2 Answers

Kajalsi45d
As far as I might be concerned, nothing worked until I rolled out this improvement to my pom.xml

<build>
...
<plugins>
...
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<executable>C:Program FilesJavajdk1.7.0_45binjavac.exe</executable>
</configuration>
</plugin>
</plugins>
</build>

Different Notes

I could see that m2e was executing in a JRE, not the JDK. Nothing I did changed this, including adding this to the eclipse.ini:

-vm
C:Program FilesJavajdk1.7.0_45binjavaw.exe
Bharatv4tg1
If you are running the Maven command from cmd, make sure you set the jdk path before running the command. In my case, I have created a .bat file containing the following:

set JAVA_HOME=C:Program FilesJavajdk1.8.0_60
start cmd.exe /k "cd c:aem_projsisaau"

Login / Signup to Answer the Question.

  • Be descriptive with your answer, and try to avoid copy-pasting external links, instead guide the user who has asked the question, where can they find the detailed answer.
  • You cannot share any URL in answer.
  • To make a text bold, surround the text with single asterisk, for example *bold text*
  • To format a text like code, surround the text within double asterisk, for example **code**
  • To add a multiline piece of code, surround the whole code within triple asterisk, for example *** multiline code ***
  • Please verify before submitting the answer.