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

If you are getting below error while running the Maven build.

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

There are 3 ways to solve No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?.


Eclipse maven error

If you are getting this error, while doing maven build on eclipse then you must check if you are using JDK rather JRE in eclipse.

    • In eclipse, click on Window -> Preferences -> Java -> Installed JREs
    • Verify that JDK is checked rather than JRE.

    • If JRE is checked, then you need to add JDK by clicking on Add -> Standard VM -> Next -> Directory and browse the JDK path

InstalledJDK

This will resolve the error in eclipse.


Add executable in pom.xml

You can set fork to true and executable to fully qualified JDK path in maven-compiler-plugin.


Set JAVA_HOME to JDK

Go to System properties -> Advanced system settings -> Advanced -> environment variable and add JAVA_HOME to environment variable.

Java_Home

Reference: https://stackoverflow.com/questions/19655184/no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-ra
I hope this will resolve the error.That’s all about No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Was this post helpful?

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *