The Java SE 6 runtime that has shipped with past versions of OS X and which has been available on-demand for Lion users is the last version that Apple will officially support in OS X, but this does not mean Java for OS X is dead. Java's parent company Oracle has taken up the reins for Java development in OS X, and yesterday announced the first version of the upcoming Java SE 7 runtime for OS X.
This update is good news for Java developers, and for end users who run Java code on Mac systems, as it is the first step for OS X to maintain the most up-to-date version of Java in OS X.
While this is good news for OS X, if you plan on trying the software out then there are some details about the Java 7 release that you should know. First is the update is for OS X 10.7 Lion only, and will not install on other versions of OS X. While the install places a separate Java runtime and development kit on the system along with others you may have, as a result if you were to copy the installed JDK file to another version of OS X, you may run into problems.
The system requirements for the Java runtime may change in the future to include Snow Leopard, but given that for now it is Lion-only suggests that support for prior versions of OS X will likely not come very soon, if ever.
In addition to being Lion only, this Java release is meant to be a development environment for creating Java applications, rather than being an official public release of the software. Therefore, even though you can use it to run and test Java applications, the plug-ins and infrastructure required to launch Java applets from Web browsers are missing.
To install the Java 7 development kit for OS X, download the installer package from the Oracle Web site and run it. The installer will check that your system meets the system requirements (it is running OS X 10.7.0 or later), and then will place the Java 7 development kit into the /Library/Java/JavaVirtualMachines/ directory along-side any versions of Java SE 6 that you may have installed. The installer will then ensure the runtimes in this directory are properly accessible, and quit.
After you have installed the Java runtime, you will then need to ensure it is enabled on your system. To do this, go to the /Applications/Utilities/ folder and open the Java Preferences utility. In the General section of this utility you should see the Java SE 7 runtime enabled, but likely listed below any other Java runtimes. You can then enable the runtime's use either by dragging it to the top of the list and keeping all runtimes enabled, or by unchecking all but the Java SE 7 runtime. If you need to use Web applets or Web Start applications, then reorganizing the list is the best option as it will allow the plug-in process to access compatible runtimes.
To check that the Java version is the latest build you just installed, open the Terminal application (in the /Applications/Utilities/ folder) and run the following command:
When this command is run, you should see output that states the installed version of the Java runtime is "1.7.0_04" along with some additional information about it. At this point, you have the latest Java runtime installed on your system and can use it for running Java applications or any development purposes you need, but do keep in mind that these settings are on a per-user basis so you will have to ensure that Java 7 is set to be enabled and be the preferred runtime for each user on the system who needs it.
If you decide you no longer wish to have the Java 7 runtime installed on your system, then you can either disable it or uninstall it completely from your system, both of which are relatively easy to do.
To disable the runtime, all you need to do is return to the Java Preferences application and uncheck the runtime in the General section, or reorganize the list so that another preferred runtime is ahead of it. If you instead wish to completely remove the Java 7 runtime, then go to the Macintosh HD/Library/Java/JavaVirtualMachines/ directory and remove the file called "1.7.0.jdk."