简体   繁体   English

在Mac OSX 10.9.5上将Java 1.8设置为默认值

[英]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". Java控制面板说我有Java 8 update45。终端说:java版本“ 1.7.0_17”。 Eclipse is using 1.7.0_17-b02. Eclipse使用1.7.0_17-b02。 Ho can I switch from Java 1.7 to 1.8 in terminal and Eclipse? 我可以在终端和Eclipse中从Java 1.7切换到1.8吗?

First I tried to make changes in Java Preferences, but is is missing from Utilities. 首先,我尝试在Java首选项中进行更改,但实用程序中缺少该属性。 Then I found Installed Java 7 on Mac OS X but Terminal is still using version 6 and have run 然后我发现Mac OS X上已安装Java 7,但是Terminal仍在使用版本6并已运行

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: 现在终端返回Java版本“ 1.8.0_45”,但是Eclipse无法启动:

The JVM shared library "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/../lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol. JVM共享库“ / Library / Internet插件/JavaAppletPlugin.plugin/Contents/Home/bin/../lib/server/libjvm.dylib”不包含JNI_CreateJavaVM符号。

you need to uninstall jdk 1.7 您需要卸载jdk 1.7

Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format: 导航到/Library/Java/JavaVirtualMachines并删除名称与以下格式匹配的目录:

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

For example, to uninstall 8u6: 例如,要卸载8u6:

% rm -rf jdk1.8.0_06.jdk

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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