Home  >  Article  >  Operation and Maintenance  >  How to configure java environment variables under macos system

How to configure java environment variables under macos system

王林
王林forward
2020-11-26 15:27:282690browse

How to configure java environment variables under macos system

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete