简体   繁体   中英

Error Perhaps you are running on a JRE rather than a JDK?

I try to run a project but gets this error. The computer is a new mac m1, previously this project was on windows

RROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project common-core: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debu

In your Intellij in main menu go to this path:

File -> Project Structure -> Platform Settings -> SDKs

In order to add new JDK click on + button and add JDK from your directory or just download a new one.

After that set your project's JDK:

File -> Project Structure -> Project Settings -> Project

In this path check the Project SDK and Project language level sections.


Two other important settings you should check for JDK for Maven that running in Intellij :

First:

File -> Settings -> Project -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing

Here in this path check JDK for importer section.

Second:

File -> Settings -> Project -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner

Here check JRE section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM