Skip to content

STS4 does not detect Fedora's JDK 11 as a JDK #530

Closed

Description

@space88man
  1. When I run STS4 under Fedora's (definitely a JDK) JDK 11, it does not detect it as such and shows

    The JRE you are running Eclipse with appears to not be a JDK.

    Spring Boot Live Hovers will not work with a plain JRE.

    Screenshot from 2020-09-09 12-54-32

  2. This happens whether the STS4 platform bundle is used, or using it as a plugin in either Fedora's Eclipse packaging or eclipse.org's Eclipse.

  3. On Fedora 32/33 if I set -vm to Azul or AdoptOpenJDK 11 it is indeed detected correctly and STS4 runs normally.

Some questions:

  1. What technical means does STS4 use to detect if the JRE is a JDK?
  2. Any ideas why a JDK is not detected as such? BTW I have definitely installed the java-11-openjdk-devel package, and Eclipse runs non-STS4 projects fine.

From this screenshot though, are live hovers actually working?

Screenshot from 2020-09-09 12-48-12

Activity

  1. martinlippert commented on Sep 9, 2020

    @martinlippert
    Member

    Hey @space88man! To me it looks like this JRE vs JDK check doesn't work correctly in your environment and we need to fix that.

    To provide a bit of background:
    There is a language server process being kicked-off in the background when you work with Spring Boot projects. This language server is written in Java and runs on the same JDK/JRE than your IDE. The language server uses specific classes for certain features (com.sun.tools.attach classes to connect to running Spring apps and retrieve live data from them). In the JDK <= 8 world, these classes are part of the tools.jar, which was only included in the JDK, not the JRE distributions. The language server itself can still work just fine on a JRE without those classes, but it will disable the feature that requires those classes to be around. In order to inform our users about this specific situation, we implemented this check for a JRE vs a JDK. That is the dialog you are seeing.

    In the JDK >= 9 world, this is slightly different, since there is no tools.jar around anymore. Instead, those classes are part of the jdk.management module. Therefore the check tries to check whether that module is around in your JRE/JDK install or not. This doesn't seem to work correctly in your case.

    Can you take a look at your JDK/JRE install to see where the modules are being located and where the jdk.management might be? I've seen a case (on macOS) where there is no jmod file, but instead some dylib files in the lib directory.

    Independent of the check, the language server itself will use the classes and enable the live hover feature when those classes can be loaded, so the feature will still work even if the upfront check does the wrong thing. In your screenshot, the Spring Boot app doesn't seem to run, so you don't see any live hovers. Please refer to the user guide section about live hovers for more details about this feature: https://github.com/spring-projects/sts4/wiki/Live-Application-Information

  2. space88man commented on Sep 9, 2020

    @space88man
    Author

    @martinlippert — wow, that's deep — followed by face palm 🤦 — Fedora has a separate package java-11-openjdk-jmods, who knew?

    Results from Fedora's JDK11 - seems to be missing jmods. Could it be due to the missing *.jmod files?

    $ find -name *management*
    conf/management
    conf/management/management.properties
    legal/java.management
    legal/java.management.rmi
    legal/jdk.internal.vm.compiler.management
    legal/jdk.management
    legal/jdk.management.agent
    legal/jdk.management.jfr
    lib/libmanagement.so
    lib/libmanagement_agent.so
    lib/libmanagement_ext.so
    

    Results from AdoptOpenJDK 11 (Zulu looks the same):

    $ find -name *management*
    conf/management
    conf/management/management.properties
    jmods/jdk.internal.vm.compiler.management.jmod
    jmods/java.management.rmi.jmod
    jmods/jdk.management.jfr.jmod
    jmods/jdk.management.jmod
    jmods/jdk.management.agent.jmod
    jmods/java.management.jmod
    legal/jdk.management.jfr
    legal/jdk.management
    legal/jdk.management.agent
    legal/jdk.internal.vm.compiler.management
    legal/java.management.rmi
    legal/java.management
    lib/libmanagement_agent.so
    lib/libmanagement_ext.so
    lib/libmanagement.so
    
  3. space88man commented on Sep 9, 2020

    @space88man
    Author

    Thank you @martinlippert ; you have pointed me in the right direction to fix an annoyance of my own contriving by omitting to install java-11-openjdk-jmods.

    Perhaps I could suggest that the error message alert the user to see if java.manamgement.jmod is installed.

    Thank you, again!

  4. martinlippert commented on Sep 9, 2020

    @martinlippert
    Member

    I think that the jmod files are not really required here, therefore I modified the check also take lib/libmanagement.so into account.

  5. added this to the 4.8.0.RELEASE milestone on Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions