如何在macOS上更新LiClipse的Java环境? [英] How can I update the Java environment for LiClipse on macOS?

查看:60
本文介绍了如何在macOS上更新LiClipse的Java环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用LiClipse/Eclipse的实例中运行LiClipse 7.1.0,该实例已经使用很长时间了,并且已经升级了很长时间.查看 LiClipse 7.1.0的发行要点,我看到更新至Eclipse 2020-09(4.17).现在需要Java 11."

[更新]另外,此LiClipse安装的升级失败.错误消息中提到"不能满足依赖关系:…致:osgi.ee;(&(osgi.ee = JavaSE)(version = 11))".有人告诉我,LiClipse需要Java 11才能成功升级.(有关该错误消息的更多信息,请参见如何理解此Liclipse(Eclipse)升级失败错误消息?.)>

我的Java版本早于11:

 %java -versionJava版本"1.8.0_31";Java(TM)SE运行时环境(内部版本1.8.0_31-b13)Java HotSpot(TM)64位服务器VM(内部版本25.31-b07,混合模式)%/usr/libexec/java_home/图书馆/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home 

我认为这意味着我拥有"Java 8"(我不清楚Java版本编号方案以及"jdk1.x"和"Java X"之间的关系,等等)

我们知道LiClipse包含其自己的Java运行时环境(JRE).请参见 LiClipse(对于Mac)是否包括自己的JRE副本?.答案:是的,LiClipse确实包括一个JRE(取决于每个平台,它可能在不同的地方)."在macOS版本上,此JRE的 Java Home 目录位于 LiClipse.app 中>捆绑包目录,位于 ./jre/Contents/Home ."[更新] LiClipse自己的JRE的版本也是1.8,而不是1.11.这不足为奇,因为该LiClipse实例已经使用和升级很长时间了.

 %cd/Applications/LiClipse \ 4.0.0/LiClipse.app/jre/Contents/Home%/Applications/LiClipse \ 4.0.0/LiClipse.app/jre/Contents/Home/bin/java -versionJava版本"1.8.0_77";Java(TM)SE运行时环境(内部版本1.8.0_77-b03)Java HotSpot(TM)64位服务器VM(内部版本25.77-b03,混合模式) 

那么,如何最好地升级LiClipse使用的JRE?如果运行Oracle Java安装程序,我希望它将JRE放置在系统位置,而不是在 LiClipse.app 捆绑目录中.

如果这有所作为,我正在MacOS 10.13.6 High Sierra上运行.由于某些原因,即使我没有运行Java 11,我也可以运行LiClipse 7.1.0.

[问题已更新以添加我想升级 LiClipse 使用的 JRE 的原因,并表明内部 JRE 不是 Java 11.]

解决方案

在寻找问题的答案时,我发现没有直接的方法可以通过用户可访问的技术在LiClipse中更新JRE.我确实找到了两个步骤的解决方法:安装具有新JRE的LiClipse的新的单独实例,然后根据以前的LiClipse安装来更新该安装.

步骤是:

  1. 退出旧版本的LiClipse.

  2. 确保您现有的工作空间目录已备份.您将要做什么从理论上讲,不会损害它.但是实际上,事情确实出错了.你做反正每小时大约备份您的计算机,对吗?

  3. LiClipse下载页面,下载新版本的安装程序的LiClipse.

  4. 安装新版本的LiClipse,请确保它不会替代以前的LiClipse版本.

  5. 运行新的LiClipse的版本,方法是右键单击其应用程序图标,然后选择打开";从弹出菜单中.

    a.如果您看到错误消息,则" LiClipse.app"已损坏,无法打开.您应该将其移至废纸rash".然后执行这些来自终端的命令:

      xattr -d com.apple.quarantine/Applications/LiClipse.appxattr -d com.apple.quarantine/Applications/LiClipse.app/Contents/MacOS/LiClipse 

    (有关原因的更多信息,请参见 LiClipse macOS安装说明.)

    b.然后重试:右键单击LiClipse的应用程序图标,然后选择打开",以运行新版本的LiClipse.从弹出菜单.

  6. LiClipse将提示您选择一个目录作为工作区.将其指向您现有的工作空间目录.

  7. LiClipse可能警告您它将升级您的工作区和旧版本Eclipse将无法再使用它.接受升级.(这是您很高兴获得备份的那一刻工作区.)LiClipse打开.

  8. 在LiClipse中,选择菜单选项文件…导入….出现导入对话框.

  9. 从中选择文件夹安装对话.项目显示在安装下.从现有中选择安装.

  10. 单击下一步".按钮,导入来源"出现应用程序对话框.

  11. 在该字段中,来自应用程序"安装",点击浏览..."按钮.文件打开对话框出现.

  12. 导航到先前版本的应用程序图标LiClipse.点击打开"按钮.文件打开对话框消失了.Eclipse组件列表显示在下部从应用程序导入对话框.这些是组成部分由以前的LiClipse副本使用.

  13. 选择那些您要导入并在新版本的LiClipse中使用.(一世选择全部.)按正常方式完成安装过程.您将返回到LiClipse主应用程序.

  14. 只需确认,选择菜单项帮助...检查更新.更新提供的其他任何内容您想采取的.(对我来说没有.)你不应该遇到无法完成安装,因为某些依赖项不能满足"错误消息.

  15. 删除旧版的LiClipse.

您现在已经成功更新了LiClipse中的JRE.

此答案改编自我的博客文章 如何在LiClipse中更新JRE (2021-05-28).那里还有一些背景说明.

I am running LiClipse 7.1.0, in an instance of LiClipse/Eclipse which has been in use and upgraded for a long, long time. Looking at the Release Highlights for LiClipse 7.1.0, I see the statement, "Updated to Eclipse 2020-09 (4.17). Java 11 is now required."

[Update] Also, an upgrade to this LiClipse installation is failing. Error messages mention "Cannot satisfy dependency: …To: osgi.ee; (&(osgi.ee=JavaSE)(version=11))". I am told that means LiClipse requires Java 11 in order to upgrade successfully. (See How can I comprehend this Liclipse (Eclipse) upgrade failure error message? for more on that error message.)

My version of Java is older than 11:

% java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
% /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home

I think that means I have "Java 8" (I'm not clear on the Java version numbering scheme, and the relationship between "jdk1.x" and "Java X", etc.)

We know that LiClipse contains its own Java Runtime Environment (JRE). See Does LiClipse (for Mac) include its own copy of the JRE? . Answer: "Yes, LiClipse does include a JRE (depending on each platform it may be on a different place)." On the macOS builds, "The Java Home directory for this JRE is within the LiClipse.app bundle directory, at ./jre/Contents/Home." [Update] The version of LiClipse's own JRE is also 1.8, not 1.11. That isn't surprising, because this instance of LiClipse has been in use and upgraded for a long time.

% cd /Applications/LiClipse\ 4.0.0/LiClipse.app/jre/Contents/Home
% /Applications/LiClipse\ 4.0.0/LiClipse.app/jre/Contents/Home/bin/java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

So, how best to upgrade the JRE which LiClipse uses? If I run the Oracle Java installer, I expect it will put the JRE in a system location, not inside the LiClipse.app bundle directory.

I am running on MacOS 10.13.6 High Sierra, if that makes a difference. For some reason I am able to run LiClipse 7.1.0, even though I am not running Java 11.

[Question updated to add reason why I want to upgrade the JRE which LiClipse uses, and to show that the internal JRE is not Java 11.]

解决方案

In my search for an answer to my question, I found no direct way to update the JRE within LiClipse via user-accessible techniques. I did find a two-step workaround: install a new, separate instance of LiClipse having the newer JRE, then update that installation based on the previous LiClipse installation.

The steps are:

  1. Quit from the old version of LiClipse.

  2. Be sure that your existing workspace directory is backed up. What you are about to do should not, in theory, harm it. But in practice, things do go wrong. You do back up your computers every hour or so anyway, correct?

  3. From the LiClipse download page, download the installer for the new version of LiClipse.

  4. Install the new version of LiClipse, being sure that it does not replace the previous version of LiClipse.

  5. Run the new version of LiClipse, by right-clicking on its application icon, and selecting "Open" from the popup menu.

    a. If you see an error message, '"LiClipse.app" is damaged and can't be opened. You should move it to the Trash.', then perform these commands from the Terminal:

    xattr -d com.apple.quarantine /Applications/LiClipse.app
    xattr -d com.apple.quarantine /Applications/LiClipse.app/Contents/MacOS/LiClipse
    

    (For more on why, see LiClipse macOS installation instructions.)

    b. Then try again: Run the new version of LiClipse, by right-clicking on its application icon, and selecting "Open" from the popup menu.

  6. LiClipse will prompt you to select a directory to serve as the workspace. Point it at your existing workspace directory.

  7. LiClipse may warn you that it will upgrade your workspace, and old versions of Eclipse won't be able to use it anymore. Accept the upgrade. (This is one moment when you are glad to have a backup of the workspace.) LiClipse opens.

  8. In LiClipse, select menu option File… Import… The Import dialogue appears.

  9. Select the folder Install from that dialogue. Items appear under Install. Select From Existing Installation.

  10. Click the "Next >" button, The Import from Application dialogue appears.

  11. At the field, "From application installation", click the "Browse…" button. A File Open dialogue appears.

  12. Navigate to the application icon for the previous version of LiClipse. Click the "Open" button. The File Open dialogue disappears. A list of Eclipse components appears in the lower part of the Import from Application dialogue. These are the components used by the previous copy of LiClipse.

  13. Select those components which you want to import and use in the new version of LiClipse. (I selected all of them.) Complete the installation process as normal. You return to the main LiClipse application.

  14. Just to confirm, select menu item Help… Check for Updates. Update anything else offered which you wish to take. (There were none for me.) You should not encounter the "Cannot complete the install because some dependencies are not satisfiable" error message.

  15. Delete the old installation of LiClipse.

You have now successfully updated the JRE in LiClipse.

This answer is adapted from my blog post, How to update the JRE in LiClipse (2021-05-28). There is a little more background explanation there.

这篇关于如何在macOS上更新LiClipse的Java环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆