Friday, October 17, 2014

Switching between JDKs and Displaying Hidden Files on OSX 10.9.5

Switching between JDKs
Running Eclipse on OS X 10.9.5, one of the plugins I use warned me that it required Java 7 to run.  So I set out to install JDK 7.  My choices were to either replace JDK 6 with 7 or to install it alongside 6 and switch between the two if (when) required.  Both appeared straight forward choices, though I went with the latter so that I can just switch instead of re-installing when needed.

This required the setting of some environment variables, namely JAVA_HOME and the modification of PATH (which I'm used to doing quickly on Windows).  Not an expert OS X user, I thought of which 'top-most' config file to append these vars into so that all users (just cuz) and all launch methods would use them.  I remembered that .bashrc is part of a hierarchy that is used to construct the lookup path, and so I'd likely want to place it somewhere near root.  Since that file or no such related file exists there, I could have just modified the ones under my /Users/<user>/ dir.

Googling a bit further, I (re)learned of /etc/launchd.conf - config file for a launch daemon.  Then I stumbled upon this little handy tool Change Java version on Mac OS.  It didn't work at first.  Turns out that the /etc/launchd.conf file needs to be created if it doesn't exist; issued this to do that: sudo touch /etc/launchd.conf.  The tool worked after that.

Hidden Files

I also learned about a couple of ways to display hidden files in finder (didn't feel like cd'ing and using nano to check out launchd.conf, and just wanted to learn to do this anyway), though this didn't go as smoothly as expected.  At first I issued:
  • defaults write com.apple.Finder AppleShowAllFiles YES; killall Finder
Which didn't work, so I tried:
  • sudo chflags -R nohidden /*
Which also didn't work, so I found:
  • defaults write com.apple.Finder AppleShowAllFiles -bool YES; killall -HUP Finder
Which also didn't work at first, but strangely, re-issuing the first one (after some time) worked.  My guess is that finder didn't want to restart properly.  So, it is either the first or last one that worked.

Relevant links

No comments:

Post a Comment