简体   繁体   English

更新由Oomph安装程序安装的Eclipse的JDK路径

[英]Update the JDK path of Eclipse installed by Oomph setup

I'm working with an Eclipse IDE which was installed by the Eclipse installer with an Oomph setup. 我正在使用由Eclipse安装程序通过Oomph设置安装的Eclipse IDE。

I recently installed a new version of the JDK and removed the old one. 我最近安装了新版本的JDK,并删除了旧版本。 I then updated the eclipe.ini file of my Eclipse installation accordingly to use the new JDK. 然后,我相应地更新了 Eclipse安装eclipe.ini文件 ,以使用新的JDK。

This works as expected so far, Eclipse is starting and the new JDK is used. 到目前为止,这可以按预期工作,Eclipse正在启动,并且使用了新的JDK。 But now every time when the Eclipse Updater runs (eg by using the "Perform setup task" option), the Eclipse Updater fails with this error when it tries to configure the JDK: 但是现在,每次运行Eclipse Updater时(例如通过使用“执行安装任务”选项),Eclipse Updater尝试配置JDK时都会失败,并显示以下错误:

Performing JRE for JavaSE-1.8 = C:\Program Files\Java\jdk1.8.0_191
Creating JRE for JavaSE-1.8 with location C:\Program Files\Java\jdk1.8.0_191
ERROR: org.eclipse.jdt.launching code=0 Target is not a JDK Root. Java executable was not found

The JDK path from the error message is the path of the old JDK version which no longer exists. 错误消息中的JDK路径是不再存在的旧JDK版本的路径。 I haven't found a place where the old JDK path is defined. 我还没有找到定义旧JDK路径的地方。 It's not defined in the Oomph setup file and also when I open the Eclipse Installer it only shows the new JDK path. 它没有在Oomph设置文件中定义,而且当我打开Eclipse Installer时,它仅显示新的JDK路径。

How can I fix this error so that the update doesn't fail? 如何解决此错误,以使更新不会失败? I seems to me that it was wrong to update the path in the eclipe.ini manually. 在我看来,手动更新eclipe.ini的路径是错误的。 What should I do instead to update the JDK path without breaking the setup? 我应该怎么做才能更新JDK路径而不破坏设置?

I searched for the path from the error message and found it in .eclipse\\org.eclipse.oomph.setup\\setups\\user.setup in my user directory. 我从错误消息中搜索路径,并在我的用户目录中的.eclipse\\org.eclipse.oomph.setup\\setups\\user.setup中找到了它。

<setupTask
    xsi:type="setup:VariableTask"
    type="JRE"
    name="jre.location-1.8"
    value="C:\Program Files\Java\jdk1.8.0_191"
    label="JRE 1.8 Location">
  <description>The location of a JDK or JRE compatible with Java 1.8.</description>
</setupTask>

This seems to be a global task that can be used by all Oomph setup files. 这似乎是一项全局任务,所有Oomph设置文件都可以使用。 After changing the value attribute to the new JDK root path (you don't have to append \\bin here) the Eclipse Updater uses the correct path and runs without issues. 在将value属性更改为新的JDK根路径(不必在此处附加\\bin )之后,Eclipse Updater使用正确的路径并且运行没有问题。

Make sure to manually run "Perform setup tasks" from the menu. 确保从菜单手动运行“执行设置任务”。 For some reason the automatic setup update which runs after starting Eclipse doesn't pick up the new path and even resets the user setup file. 由于某种原因,在启动Eclipse之后运行的自动安装程序更新不会选择新路径,甚至不会重置用户安装文件。

I guess it would have been enough to just update the path in user.setup . 我想仅仅更新user.setup的路径就user.setup The Eclipse Updater then would have updated all Eclipse installations' eclipse.ini files automatically when I run their setup tasks. 然后,当我运行Eclipse Updater的安装任务时,它们会自动更新所有Eclipse安装程序的eclipse.ini文件。

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

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