I use Catalina. I created the .bash_profile
file and edited it.
I wrote export JAVA_HOME=$(/usr/libexec/java_home)
in this file and typed source ~/.bash_profile
, after that typed echo $JAVA_HOME
and showed the path but when I reopen the terminal and type echo $JAVA_HOME
, doesn't show the path again.
What is the problem?
New user accounts in Catalina default to using zsh
, not bash
. You need to set your environment in ~/.zprofile
, not ~/.bash_profile
.
~/.bash_profile
is executed at the time of login. If you just log out and login again, it should be fine. For interactive non-login shells .bash_rc
is used.
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.