简体   繁体   中英

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.

I recently installed a new version of the JDK and removed the old one. I then updated the eclipe.ini file of my Eclipse installation accordingly to use the new JDK.

This works as expected so far, Eclipse is starting and the new JDK is used. 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:

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. I haven't found a place where the old JDK path is defined. It's not defined in the Oomph setup file and also when I open the Eclipse Installer it only shows the new JDK path.

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. What should I do instead to update the JDK path without breaking the setup?

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.

<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. 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.

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.

I guess it would have been enough to just update the path in user.setup . The Eclipse Updater then would have updated all Eclipse installations' eclipse.ini files automatically when I run their setup tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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