The specific configuration steps are as follows:
1. Edit bash_profile
vim ~/.bash_profile 输入以下内容并保存 export JAVA_HOME=`/usr/libexec/java_home` export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
2. Make the environment variables effective
source ~/.bash_profile
3. Verify
tianshl@tianshl ~ $ echo $PATH
4. Note
Before using fish, you must exit fish
/usr/libexec/java_home This command can output the path of JAVA_HOME
Related recommendations: macos
The above is the detailed content of How to configure java environment variables under macos system. For more information, please follow other related articles on the PHP Chinese website!