current position:Home>mac Maven error No compiler is provided in this environment. Perhaps you are running on a JRE rat

mac Maven error No compiler is provided in this environment. Perhaps you are running on a JRE rat

2022-08-06 17:39:47That year - snow in the sky

1. The environment variables of java may not be matched,

Reconfigure it

Enter the command: [/usr/libexec/java_home -V] to view the default jdk installation path address (the green underline is the jdk default path) (Note️: The command line terminal is size-sensitiveWrite [-v is wrong, it must be uppercase -V])

vi ~/.bash_profile edit environment variables and add the following commands

JAVA_HOME must fill in its own installation path

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home

PATH=$JAVA_HOME/bin:$PATH:.

CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.

export JAVA_HOME

export PATH

export CLASSPATH

Close the terminal, the terminal will automatically save

Enter the command [source .bash_profile] to make the configuration take effect

Enter [echo $JAVA_HOME] to display the path just configured

2. Check IDea configuration

Check the Project SDK and Project language level configured in the project
Detect Preferences | Build, Execution, Deployment
---->Build Tools -> Maven -> Runner -> JRE
---->Compiler -> Java Compiler -> Project bytecode version

3. The configuration fails for some reason

Execute mvn -version to see that the jdk directory specified by maven is not the correct local jdk path;

Try to reload source ~/.bash_profile; after reloading, it is found that the jdk path specified by maven is correct; at this time, the execution of the packaging command still reports an error;

4. It may be that the idea is not loaded, so execute source ~/.bash_profile in the idea console,

copyright notice
author[That year - snow in the sky],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/218/202208061715578616.html

Random recommended