Article Directory
The shell script executes the packaging command mvn clean install -Dmaven.test.skip=true locally, and the JDK error cannot be found. The java environment variable needs to be reconfigured
1. Java SDK download
下载地址:https://www.oracle.com/java/technologies/downloads/#jdk18-mac
下载完成后点击安装,按照提示进行操作
2. Check the Java version
Java -version
3. Check the Java installation location
/usr/libexec/java_home -V
result
Matching Java Virtual Machines (2):
1.8.371.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_371 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
4. Configure environment variables
The zsh used by the shell, the configuration file is entered in the .zshrc
to enter the configuration file
vi .zshrc
configuration content
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home"
CLASS_PATH="$JAVA_HOME/lib"
PATH=".$PATH:$JAVA_HOME/bin"
export JAVA_HOME
export PATH
export CLASSPATH
Make the configuration take effect
source ~/.zshrc