要打开“Eclipse”,您需要安装旧版 Java SE 6 运行时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26847411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:27:03  来源:igfitidea点击:

To open "Eclipse" you need to install the legacy Java SE 6 runtime

eclipseosx-yosemite

提问by Brad Thomas

Just installed a fresh version of Kepler 64bit "for Java Developers" on Yosemite, getting this error on first launch. Any thoughts on how to fix? Really do not want to downgrade my Java version!

刚刚在 Yosemite 上安装了一个新版本的 Kepler 64bit“for Java Developers”,第一次启动时出现这个错误。关于如何修复的任何想法?真的不想降级我的Java版本!

采纳答案by Brad Thomas

I ended up relenting and downloading Java 6 from here:

我最终从这里让步并下载了 Java 6:

http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US

http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US

Apparently this seems to coexist ok with the latest Java version which I also installed (version 8 update 25) and version 8 shows up as the version I'm running when I verify from

显然,这似乎与我也安装的最新 Java 版本(版本 8 更新 25)共存,并且版本 8 在我验证时显示为我正在运行的版本

https://www.java.com/en/download/installed.jsp

https://www.java.com/en/download/installed.jsp

I'm unclear on the security implications of this though, would have preferred another solution, if anyone finds a better solution than installing 6 please let me know.

我不清楚这对安全的影响,但我更喜欢另一种解决方案,如果有人找到比安装 6 更好的解决方案,请告诉我。

回答by Larry Kyrala

I just encountered this in another Eclipse-based app on Yosemite and figured out (with help from the references below) how to get the app running withoutinstalling the legacy Java SE 6 JRE. Here are the steps in case it helps other devs get Eclipse working.

我刚刚在 Yosemite 上的另一个基于 Eclipse 的应用程序中遇到了这个问题,并想出了(借助下面的参考资料)如何在安装旧版 Java SE 6 JRE 的情况下运行应用程序。以下是帮助其他开发人员使 Eclipse 工作的步骤。

PRECONDITIONS

前提条件

$ sw_vers -productVersion 
10.10.1
$ 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)

Other configurations might work; this is my environment.

其他配置可能有效;这是我的环境。

STEPS

脚步

  1. Edit the info.plist for the JDK after installing:

    $ sudo nano `/usr/libexec/java_home -V`/../info.plist
    
  2. Change the following section:

    <key>JVMCapabilities</key>
     <array>
      <string>CommandLine</string>
     </array> 
    

    to

    <key>JVMCapabilities</key>
     <array>
      <string>JNI</string>
      <string>BundledApp</string>
      <string>WebStart</string>
      <string>Applets</string>
      <string>CommandLine</string>
     </array>
    
  3. Try to open the app from the command-line (not sure if this is strictly necessary, but what I did)

    You should get an error "(app) can't be opened because it is from an unidentified developer."

  4. Go to System Preferences: Security Settings (General) and you should see the recent app next to a button "Open Anyway" -- click this button to open the app.

  1. 安装后编辑 JDK 的 info.plist:

    $ sudo nano `/usr/libexec/java_home -V`/../info.plist
    
  2. 更改以下部分:

    <key>JVMCapabilities</key>
     <array>
      <string>CommandLine</string>
     </array> 
    

    <key>JVMCapabilities</key>
     <array>
      <string>JNI</string>
      <string>BundledApp</string>
      <string>WebStart</string>
      <string>Applets</string>
      <string>CommandLine</string>
     </array>
    
  3. 尝试从命令行打开应用程序(不确定这是否绝对必要,但我做了什么)

    您应该收到错误消息“无法打开(应用程序),因为它来自身份不明的开发人员。”

  4. 转到系统偏好设置:安全设置(常规),您应该会在“仍然打开”按钮旁边看到最近使用的应用程序——单击此按钮以打开应用程序。

This opens Eclipse without requiring the separate download of the legacy Java SE 6 files.

这将打开 Eclipse,而无需单独下载旧的 Java SE 6 文件。

NOTES

笔记

When I was solving this on MTGBrowser (below) I also followed advice to change the info.plist of the app by adding the following section to the 'Eclipse' key:

当我在 MTGBrowser(如下)上解决这个问题时,我还按照建议通过将以下部分添加到“Eclipse”键来更改应用程序的 info.plist:

<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java</string>

However, I'm not sure that's strictly required. In any case, that wasn't sufficient -- I also had to change the JDK info.plist and security as described above for a complete solution.

但是,我不确定这是严格要求的。无论如何,这还不够——我还必须更改 JDK info.plist 和安全性,如上所述以获得完整的解决方案。

REFERENCES

参考

回答by daniel

I was facing this trouble for hours. I followed every suggestion I could find over numerous forums with no success. I resolved the issue by simply installing 1.8.x JDK instead of the JRE, despite having no intension to develop for Java. I guess eclipse requires this.

我几个小时都面临这个问题。我遵循了我在众多论坛上找到的每一个建议,但都没有成功。我通过简单地安装 1.8.x JDK 而不是 JRE 解决了这个问题,尽管我无意为 Java 开发。我想日食需要这个。

回答by Mark Chackerian

tldr;This error may indicate you don't have Java, and you can fix by installing the latest version of Java instead of the "legacy" version

tldr; 此错误可能表示您没有 Java,您可以通过安装最新版本的 Java 而不是“遗留”版本来修复



I received this error while installing Eclipse on a fresh MacBook with macOS Sierra, version 10.12.3, which apparently does not have ANY java installed. I made the problem go away by installing java version 1.8 JDK and then had no trouble installing Eclipse after.

我在装有 macOS Sierra 版本 10.12.3 的全新 MacBook 上安装 Eclipse 时收到此错误,该版本显然没有安装任何 java。我通过安装 java 1.8 JDK 解决了这个问题,然后安装 Eclipse 没有问题。

i.e. before installing

即安装前

MacBook-Pro:$ java -version
No Java runtime present, requesting install.

and after installing

并安装后

MacBook-Pro:$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

回答by VHristov

My Mac crashed and after the restart I had the same issue. Turned out that for some reason the file /usr/libexec/java_homewas missing. After symlinking it to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home, Eclipse now starts without any complains.

我的 Mac 崩溃了,重新启动后我遇到了同样的问题。原来由于某种原因该文件/usr/libexec/java_home丢失了。将其符号链接到 后/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home,Eclipse 现在启动时没有任何抱怨。

回答by Black

I had JDK 7 installed on Yosemite, and upgrading Eclipse to Lunafixed this issue for me

我在 Yosemite 上安装了 JDK 7,并升级了 EclipseLuna为我解决了这个问题