Mac OS X’s Java Preferences.app has a pane for switching between versions of the JDK, but I just found out from a coworker (thanks, Mike!) that you can make your shell match that preference easily — just add this to your ~.bashrc:
|
1 |
export JAVA_HOME=$(/usr/libexec/java_home) |
If you change your JDK priority preference, you’ll need to re-source your ~/.bashrc or just open a new terminal window.