Java on OS X 10.9 (and later)
Getting the right Java package[edit]
Until Mac OS X version 10.8 Apple used to ship the operating system with it's own Java package preinstalled (called Java for OS X). As of OS X 10.9 ("Mavericks") Apple changed that and stopped publishing their own Java packages. OS X 10.9 and later comes without Java, and an upgrade from an earlier version of OS X will remove the previously installed Java for OS X package. To use Java one would usually install the latest Oracle Java package, currently (November 2015) Java 8, a.k.a. Java 1.8.
However, Max (at least until version 7.0.6) will not work with Oracle Java. To use Java and the [mxj] object in Max you need to (re-) install the legacy Apple Java 6 for OS X. This version of Java is several years out of date, and there will be no further updates from Apple. OS X 10.11 "El Capitan" will be the last version of OS X to support the installation of legacy Apple Java for OS X; later versions of OS X can only use Oracle Java. Cycling 74 is currently not actively developing the mxj object, so this may become a problem in the future.
For security reasons, it is not recommended to use the Apple Java 6 Web Plugin for your browser, and the above installer from Apple will not install it. If you need to use Java applets in your browser, you can install the latest Oracle Java JRE for your browser, alongside Apple Java 6 for Max. Oracle Java JRE installs only the web browser plugin, and does not update the system or command line links. Java applets on the web will use Oracle Java in the browser, while Max and any application that uses the system-wide Java, such as from the command line or by double-clicking on a .jar file, will use the deprecated Apple Java 6, which is known to have bugs and security risks. However, many Java applications, such as Processing, include their own private copy of the Java JRE bundled into the application; normally this will be a recent Oracle version, which will be used only by the application.
If you need to run the latest security-patched java from the command line, to develop your own applications, or launch .jar files, you can install the Oracle Java JDK. If you have already installed the Oracle JDK, you may need to uninstall it before installing Apple Java for OS X. It should be possible to re-install it again afterwards.
Note that the SIP (System Integrity Protection) in OS X 10.11 El Capitan or later may interfere with installation of Java.
Limitations with Java for OS X[edit]
As Max is currently bound to Java for OS X the maximum supported Java version is 1.6 (update 65). This means Max can't handle mxj classes compiled with Java 1.7 or later.