Search code examples
javamacosjava-11liclipse

How can I update the Java environment for LiClipse on macOS?


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


Solution

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