SDKMAN! does not work with Eclipse.app or SpringToolSuite4.app (on Mac)

前端 未结 3 1957
孤独总比滥情好
孤独总比滥情好 2021-02-19 04:39

This is a similar issue to: Eclipse can't find jdk installed with sdkman

I am still facing the issue on Mac (macos-mojave)

Both of my

         


        
相关标签:
3条回答
  • 2021-02-19 05:09

    Here is how I got it working [1] on MacOS Catalina.
    I had to set the -vm path in my eclipse.ini to:

    /Users/<YOUR_USER>/.sdkman/candidates/java/current/lib/jli/libjli.dylib
    

    Apparently Eclipse on MacOS always uses JNI invocation to load the VM [2] so I had to make it point to the libjli.dylib instead of the regular java executable.

    Links:
    [1] Thanks to: https://bugs.eclipse.org/bugs/show_bug.cgi?id=549813
    [2] https://help.eclipse.org/2020-03/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Flauncher.html&cp%3D2_1_5_1

    0 讨论(0)
  • 2021-02-19 05:12

    I faced this problem on macOS Sierra while trying to use OpenJDK 11.0.2 installed by SDKMAN! in conjunction with Eclipse 2019-06. No other SDKs installed.

    macOS consistently seems to refuse launching Eclipse.app for almost all combinations of -vm parameters I supplied in Info.plist and eclipse.ini, except for links to /System/Library/.

    Here is my working setup:

    1. I did an sdk default java 11.0.2-open rather than just sdk use. I made sure SDKMAN! symlinked JDK command binaries properly into the /System/Library path:
    lrwxr-xr-x  1 root  wheel  75  1 Mai  2017 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
    

    Although the symlink destination is not a link anymore, it is the binary that SDKMAN! deployed there. Check it with the -version.

    1. I made sure no <string>-vm</string> parameter is present in Info.plist. All commented out.

    2. My -vm arg in eclipse.ini is:

    -vm
    /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
    

    As stated previously, make sure this statement appears before -vmargs.

    This finally allows me to launch a recent Eclipse by double-clicking in the Finder or launching the eclipse binary directly. Hope this applies to STS as well.

    Good luck.

    0 讨论(0)
  • 2021-02-19 05:27

    If the Eclipse launcher cannot find a suitable JVM to run on (which I am assuming is the problem here), you can usually work around this by pointing the 'eclipse.ini' (or 'STS.ini' as the case may be) to the JVM of your choice.

    To do this, open the .ini file in a text editor and add two lines at the front of the file. Something like this:

    -vm
    /usr/lib/jvm/jdk-1.8.0/bin/java
    ... the rest of the file unchanged...
    

    Note it is important that:

    1) these lines are the very first in the file

    2) they are on two separate lines (don't try to put both -vm and path of the jvm executable on a single line, it doesn't work).

    0 讨论(0)
提交回复
热议问题