Li'
Li'

Reputation: 3183

fail to set java environment variables on mac

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.

Upvotes: 0

Views: 494

Answers (1)

Frederic Close
Frederic Close

Reputation: 9639

on OSX by default .bash_profile is used, not .bashrc

Upvotes: 2

Related Questions