The Java control panel and command line show different versions of Java 1.7 on Mac OS X 10.9.5. What?

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:

Java version reported by Java Control Panel

What gives? Can someone explain?

+6
source share
2 answers

Basically, Mac OS X starts without any Java, and if Java is required for any installed application or website, it allows you to install the Java JRE.

JRE is installed with a simple, non-programmer user. It is a runtime environment, has no development tools, and includes Java Webstart. It also has a control panel that allows the user to control things like security, updates, etc.

If you want to program Java on MacOS X, you install the JDK. The JDK is installed in a different way and, as a rule, does not have a user level connection to the JRE. That is, it does not affect the control panel, which is designed to control the JRE at the user level.

Tools designed to work with the JDK point to the JDK JRE, and those that are designed to work with the JRE at the user level indicate this.

I can’t say for sure why they decided to completely diverge between the Java user and the Java developer. But I can assume that the Mac can be used by several users. Suppose one of these users is a developer and makes changes to the Java installation, such as revoking and adding security keys to the keystore, changing security policy files, etc. I believe that Oracle does not want these changes in Java development to affect all other Mac users who are unaware of the development environment and cannot make changes to it.

You upgrade the JDK by downloading the full version from the Oracle website. Keep in mind that each new JDK is installed in addition to the old JDK, but is installed as a new one by default. If you want to remove the old JDK, you must do it manually by following the instructions on the Oracle website.

+13
source

If you use jdk-7uNN-macosx-x64.dmg through Java , it will install jdk in /Library/Java/JavaVirtualMachines/ and jre in /Library/Internet\ Plug-Ins/ .

At the command prompt, starting java points to /Library/Java/JavaVirtualMachines/jdk1.7.0_NN.jdk/Contents/Home/bin/java . On the other hand, the Java control panel points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java , which will be automatically updated.

+3
source

Source: https://habr.com/ru/post/981808/


All Articles