一天晚上,我在 Eclipse 中工作(也从命令行使用 Android 的 DDMS)。第二天早上,我打开盖子...尝试运行 Eclipse 并出现错误。
me$ sudo /Applications/eclipse/eclipse
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
因此我尝试找出我的 JDK 指向的位置:
me$ ls -la /System/Library/Frameworks/JavaVM.framework/Versions/
total 64
drwxr-xr-x 12 root wheel 408 Nov 16 10:44 .
drwxr-xr-x 12 root wheel 408 Sep 7 09:39 ..
lrwxr-xr-x 1 root wheel 5 Sep 7 17:07 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Dec 2 2009 1.3.1
lrwxr-xr-x 1 root wheel 10 Sep 7 17:07 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Sep 7 17:07 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Sep 7 17:07 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Sep 7 17:07 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Sep 7 17:07 1.6 -> CurrentJDK
drwxr-xr-x 9 root wheel 306 Nov 16 10:44 A
lrwxr-xr-x 1 root wheel 1 Sep 7 17:07 Current -> A
lrwxr-xr-x 1 root wheel 59 Sep 7 17:07 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
到目前为止一切看上去都很正常……
me$ ls -la /System/Library/Java/JavaVirtualMachines/
total 0
drwxr-xr-x 2 root wheel 68 Nov 16 10:44 .
drwxr-xr-x 5 root wheel 170 Nov 16 10:44 ..
显然,我的虚拟机已被删除或移动?
我可能只需重新安装 Java 即可,但有人知道为什么会发生这种情况或如何在将来防止这种情况发生吗?