Apple’s Java update this week removes the Java Preferences.app from Utilities. When working between different versions of Java in varied development environments it no longer seems easily achievable to change from Java 6 to Sun’s 1.7 as before.
I believe that there still should be a shell mechanism in place to accomplish this, however I’m not readily finding it. How do you PROPERLY change the current active version of Java whilst in a shell session?
(I say PROPERLY because I want to be sure that all env vars are set appropriately such as JAVA_HOME, it’s path, etc.)
Additionally, I thought, a couple of years ago, I had stumbled across a script that would change Java env’s for you by simply listing the options and then defining which one to switch to. It may be that I’m getting confused with the tool in Ubuntu, but I am nearly certain it was for OS X… It would be helpful to either know what this was or perhaps we should write a quick script, if one doesn’t exist, that will meet this need; perhaps inserting it into Homebrew?
Thanks to @MadProgrammer who initially replied to this question. I got to exploring things a little more and found some examples that helped me with the following script that I’m now using to execute Java applications that will not function with Java 1.7 currently:
One potentially useful situation for this is to create a script to run Minecraft that is having problems with with the 1.7 release scenario. Obviously there are other similar apps that are having some varying degrees of problems and this will likewise be useful to control the Java version you wish to use rather than just using the default method or trying to hack around the symlinks.