Running java_home
shows:
> /usr/libexec/java_home -verbose
Matching Java Virtual Machines (1):
1.7.0_45, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
But the Java Control Panel says:
What gives? Can anybody explain?
Update Java in the Java Control PanelLaunch the Java Control Panel by clicking the Java icon under System Preferences. Go to the Update tab in Java Control Panel and click on Update Now button that brings up Installer window. Click on Install Update. Click on Install and Relaunch.
Basically, Mac OS X starts out without any Java, and if any installed application or web site requires Java, it allows you to install a Java JRE.
The JRE is installed with a plain, non-programmer user in mind. It is a runtime environment, has no associated development tools, and includes the Java Webstart. It also comes with a control panel that allows a user to control things such as security, updates etc.
When you want to program with Java on MacOS X, you install a JDK. The JDK is installed in a different path, and generally has no connection to the user-level JRE. That is, it is not reflected in the control panel, which is intended to control the user-level JRE.
Tools intended to work with the JDK will point to the JDK's JRE, and those that are intended to work with the user-level JRE will point to that.
I can't say exactly why they decided to have a full separation between the user Java and the developer Java. But I can offer a guess: Macs can be used by more than one user. Suppose one of those users is a developer and is making changes to the Java installation such as revoking and adding security keys in the keystore, changing the security policy files etc. I suppose Oracle doesn't want those changes in the development Java to affect all the other users of the Mac, who are not aware of the existence of the development environment and cannot make changes in it.
You update the JDK by downloading a full version from the Oracle web site. Mind you, every new JDK is installed in addition to the old JDK, but is set as the new default. If you want to remove the old JDK, you must do so manually, following the instructions on the Oracle site
If you use jdk-7uNN-macosx-x64.dmg
via Java, it will install jdk
in /Library/Java/JavaVirtualMachines/
and jre
in /Library/Internet\ Plug-Ins/
.
At the command line, running java
points to /Library/Java/JavaVirtualMachines/jdk1.7.0_NN.jdk/Contents/Home/bin/java
. On the other hand, Java Control Panel points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
, which will automatically update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With