I got a weird problem when I try to set java environment variables on my mac. Here is what I did:
nano ~/.bashrc
edit:
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATH
save then
source ~/.bashrc
check
echo $JAVA_HOME
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
So far everything is good. But my problem is that when I reboot, echo $JAVA_HOME shows nothing. After typing source ~/.bashrc again, echo $JAVA_HOME shows the correct result which means I need to type source ~/.bashrc every time when I reboot mac.
在OSX上默认使用.bash_profile
,而不是.bashrc
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.