Using an older version of Java JDK in Mac OSX

This StackOverflow thread gives instructions on how to How to Revert to Java 1.6.

I ran this command and got this result:


prem$ /usr/libexec/java_home -v '1.6*'
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

That directory doesn’t seem to exist according to ls:


prem$ ls /Library/Java/JavaVirtualMachines
./ ../ jdk1.7.0_67.jdk/

However, running the given command to change the JDK actually seemed to work:


prem$ export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'`
prem$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

It’s still pretty mysterious to me how this works.

.bash_profile madness on OSX

I ran into some issues setting up my terminal correctly on OSX. Namely, whenever I’d open a new tab on Terminal, my ~/.bashrc script didn’t get executed. So, I had no syntax highlighting, and I had none of my aliases.

It turns out that ~/.bashrc isn’t designed to be run for Terminal. This StackExchange answer hasĀ an explanation of why:

Why doesn’t .bashrc run automatically?

Terminal opens a login shell. So I followed their advice and sourced ~/.bashrc in ~/.bash_profile