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

Viewed 2489

I am trying to clean maven project using IntelliJ on mac by running below command but getting error. Please suggest what needs to be done to fix this

./mnwn clean package

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

Thanks

2 Answers

The issue is not related to IntelliJ IDEA, you should get the same behavior when you run this command in the system Terminal.

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. Make sure it prints the correct Java version of the JDK and not a JRE.

I was facing similar error while workspace setup on a new MAC system.

I was initially referring "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin" as JAVA_HOME path but it was not correct.

The correct JDK path was "/Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home". If you JDK with default installation path on MAC then cross check your JAVA_HOME. It might help you to solve your problem.

Related