Can't set JAVA_HOME on Catalina

試著忘記壹切 提交于 2020-08-24 03:46:10

问题


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?


回答1:


New user accounts in Catalina default to using zsh, not bash. You need to set your environment in ~/.zprofile, not ~/.bash_profile.




回答2:


~/.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.



来源:https://stackoverflow.com/questions/60012746/cant-set-java-home-on-catalina

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!