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

Maven compile a project in Eclipse IDE, but hits the following error messages :


$ mvn clean compile

[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: 0.859 s
[INFO] Finished at: 2018-10-03T15:56:43+08:00
[INFO] ------------------------------------------------------------------------

P.S Tested with Maven 3.5.3 and Eclipse SimRel 2018-09

By default, Eclipse configured the JRE automatically.

Solution

Maven needs JDK to compile project. Make sure you have installed/downloaded JDK and add it into Eclipse IDE as installed JRE.

1. Windows -> Preferences -> Java -> Installed JREs -> Add… , select a JDK folder.

2. Add a new JDK as JRE and checked it.

Done. Recompile it again.

References

  1. Using Maven within the Eclipse IDE – Tutorial

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
pierluigi vernetto Recent comment authors
newest oldest most voted
pierluigi vernetto
Guest
pierluigi vernetto

Thanks for the tip. I wonder what sense it makes nowadays to maintain a separation between JRE and JDK, it complicates our life just to save a few MB of disk space