OSX Eclipse:搜索以下位置后未找到Java虚拟机

时间:2015-01-19 09:12:09

标签: java eclipse macos

我在OSX 10.10上安装了Java 1.8.0.25 JDK。当试图打开eclipse(64Bit)时,我收到以下错误消息:

  

必须提供Java运行时环境(JRE)或Java Development Kit(JDK)才能运行Eclipse。

     

搜索以下内容后未找到任何Java虚拟机   地点:   /Library/Java/JavaVirtualMachines/1.8.0.25.jdk/Contents/Home/bin/java

但是当我查看我的路径时,一切正常......

export JAVA_HOME="$(/usr/libexec/java_home)"
export PATH=$PATH:$JAVA_HOME/bin
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home


$ /usr/libexec/java_home
 /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

$ /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/
Home/  MacOS/ 

$ /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/
bin/     db/      include/ jre/     lib/     man/     

$ /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/
appletviewer    jarsigner       javafxpackager  jcmd            jhat            jmc             jstack          keytool         policytool      schemagen       unpack200       
extcheck        java            javah           jconsole        jinfo           jps             jstat           native2ascii    rmic            serialver       wsgen           
idlj            javac           javap           jdb             jjs             jrunscript      jstatd          orbd            rmid            servertool      wsimport        
jar             javadoc         javapackager    jdeps           jmap            jsadebugd       jvisualvm       pack200         rmiregistry     tnameserv       xjc             

$ /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

$ ls /usr/bin/java
lrwxr-xr-x  1 root  wheel    73B 11 Nov 16:56 /usr/bin/java -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

$ "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

我还按照许多其他主题中的建议编辑了-vm选项eclipse.ini

...
--launcher.defaultAction 
openFile
-vm 
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
-vmargs
...

但没有任何作用,我仍然得到上述信息。有没有人知道如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

我在安装新的jdk(并删除旧的jdk)后遇到了同样的问题。解决方案是在eclipse.ini

中修复vm的路径

另见ENV变量$JAVA_HOME/usr/libexec/java_home

答案 1 :(得分:-1)

尝试重新/安装:http://support.apple.com/kb/DL1572?viewlocale=en_US

我遇到了同样的问题。我怀疑是因为Apple创建的一些Java基础架构搞砸了我的mac。可执行文件恢复它们,但仍然指向我之前安装的当前JDK的所有内容。