I have installed Oracle's latest java JDK 1.7 as default here on 10.8.4 for security reasons. But I also wanted to be able to continue to use Apple's java 1.6 with some apllications that depend on it. The fixed upade 2013-004 (Build ...M4509) works well again.
Switching the default java would be a possibility, but I seems rather cumbersome to switch back and forth each time.
I found a solution that allows me to have java 1.7 as default and switch to 1.6 in conjunction with the launch of a specific app. It involves exporting java as described by Gerry above and launching the app via AppleScript.
I made an AppleScript.app rather than resorting to the terminal each time.
The following is an example which works for me in this case with the program JGR.app (a nice java GUI for R and Deducer).
Open AppleScriptEditor
type in the following 3 lines
do shell script "JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
export JAVA_HOME
/Applications/JGR.app/Contents/MacOS/JGR"
save the app
by selecting "Application" from the drop down menu and name the app as you like.
Double clicking the newly created app will invoke the java version specified in the script and start the program. Double clicking the progrm itself will still attempt to start it under the default java environment, if that works.
The script assumes that all components reside in their typical location on the Mac. Otherwise the path needs to changed accordingly. It also requires the java program to call java via java_home.
It is not a switch, but a convenient way to use different java versions side by side without a need for repeatedly switching the default.