Java’s parent company Oracle has taken up Java development in OS X, and updated the first version of the upcoming Java SE 7 runtime for OS X.
This update is most useful for Java developers, and for end users who run Java code on Macsystems, as it is the first step for OS X to maintain the most up-to-date version of Java in OS X. However, the update is for OS X 10.7 Lion only, and will not install on other versions of OS X. The system requirements for the Java runtime may change in the future to include Snow Leopard.
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 alongside 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: java -version
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. However, 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 named “1.7.0.jdk.”