Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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? 
like image 830
Sai prateek Avatar asked Oct 29 '13 10:10

Sai prateek


People also ask

How do you resolve no compiler is provided in this environment Perhaps you are running on a JRE rather than a JDK in Intellij?

To fix the issue install any JDK on your system and make sure the bin subdirectory of the JDK home directory is added to PATH environment. You may also want to set JAVA_HOME environment variable pointing to this JDK installation home directory. To verify that it works run java -version in the system Terminal.

Are you running a JRE instead of a JDK?

Perhaps you are running on a JRE rather than a JDK? This error doesn't mean that your project has some problem but it is just because some wrong Java related configuration in your IDE which you must correct to successfully run your project. To fix this issue you will have to update your IDE preferences.


1 Answers

  1. On your Eclipse IDE, go into Window > Preferences > Java > Installed JREs > and check your installed JREs. You should have an entry with a JDK there.
  2. Select the Execution Env as show below. Click OK
  3. Then Right-Click on your Project -> Maven -> Update Project

Additionally, you may have to change Maven JRE (see @jlars62 answer) which is as follows. Goto Run -> Run Configurations, selecting the Maven Build I was running (from the left panel). Then, I clicked the JRE tab and selected the option Workspace default JRE

enter image description here

like image 138
jaipster Avatar answered Oct 04 '22 05:10

jaipster