How to change the default JRE/JDK order without the Java Preferences app

If you execute a java -version or javac -version command, the output depends on what you've set up as the JRE/JVM order in the Java Preferences app (which is in /Applications/Utilities). The question is: how does this app work, where does it store it's settings?

I've examined my Snow Leopard system and there the Java Preferences app writes it's settings into a binary property list (plist) file at the following location: $HOME/Library/Preferences/ByHost/ The $HOME variable should be substituted with the user's home directory (eg. /Users/myuser or for the root user it's /var/root). The UUID string represents some sort of a unique ID for the given Mac and it can be fetch with something like this:
system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}' | awk -F"-" '{print $NF}'

These plist files are standard Mac binary property lists, but for some reason Xcode 4.2 always crashes, when I try to open a binary plist with it. And during Xcode 4.2 install my Property List Editor was removed Sad, so I had to dig it up and reinstall it manually to be able to edit it.

Syndicate content