简体   繁体   中英

Make Java 1.8 default on Mac OSX 10.9.5

The Java Control Panel says I have Java 8 update 45. Terminal says: java version "1.7.0_17". Eclipse is using 1.7.0_17-b02. Ho can I switch from Java 1.7 to 1.8 in terminal and Eclipse?

First I tried to make changes in Java Preferences, but is is missing from Utilities. Then I found Installed Java 7 on Mac OS X but Terminal is still using version 6 and have run

sudo rm /usr/bin/java
sudo ln -s /Library/Internet\ PlugIns/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin

Now terminal return java version "1.8.0_45", but Eclipse does not start:

The JVM shared library "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/../lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol.

you need to uninstall jdk 1.7

Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:

/Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk

For example, to uninstall 8u6:

% rm -rf jdk1.8.0_06.jdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM