MacOS – Install Java JRE 6 (next to JRE 7) on OS X 10.10 Yosemite

javamacos

I need to test a web application with JRE 6. I am using a Mac with OS X 10.10 and Java 7 for development. How can I install JRE 6 next to Java 7 on this Mac?

This previous answer does not yet account for the fact (also mentioned in a comment) that Apple's download link by now points to a .pkg (Java for OS X 2014-001) file. Without further knowledge I hasten to install it, for it may overwrite my current Java 7 setup (and may no longer contain JRE 6 in the first place).

Best Answer

JavaForOSX2014-001.dmg contains Java for Mac OS X (1.6.0_65-b14-462). It will be installed to /System/Library/Java and /System/Library/Frameworks while Oracle Java is located at /Library/Java. No file will be overwritten.
To avoid any trouble (especially with your $JAVA_HOME/$PATH) consider setting up a Mac OS X VM in VMWare, Parallels or VirtualBox with JRE6 only.