Skip to content

Boot Hint does not work with Java JDK 9.0.1 #30

Closed

Description

@khe817

Error on start up:

JAVA_HOME environment variable points either to JRE or JDK missing "lib/tools.jar" hence Boot Hints are unavailable

Boot Hint works if I copy "lib/tools.jar" from older java jdk version to jdk-9.0.1/ folder.

Activity

  1. martinlippert commented on Dec 25, 2017

    @martinlippert
    Member

    Hey @khe817, I thought we put something in place to make things work with JDK9 (should work out of the box), but looks like there is something going wrong here. What OS are you running on?

  2. martinborgman commented on Dec 25, 2017

    @martinborgman

    As far as I can tell an empty tools.jar works just as well

  3. BoykoAlex commented on Dec 25, 2017

    @BoykoAlex
    Contributor

    @khe817 are you trying the latest 0.1.2 version? Is JDK 9.0.0 working?

  4. BoykoAlex commented on Dec 25, 2017

    @BoykoAlex
    Contributor

    Ok, I have just tried 0.1.2. Boot hints should work with Java 9.0.1 regardless of the message:

    JAVA_HOME environment variable points either to JRE or JDK missing "lib/tools.jar" hence Boot Hints are unavailable
    

    No need to copy tools.jar. It doesn't look properly for tools.jar in Java 9 and hence shows the message but it still uses tools.jar. We should just correct the lookup for tools.jar for java 9 not to show the message that's all. It works regardless of the message.

  5. martinborgman commented on Dec 25, 2017

    @martinborgman

    The message comes from a test in vscode-extensions/vscode-boot-java/lib/Main.ts

            classpath: (context: VSCode.ExtensionContext) => {
                const classpath = [
                    Path.resolve(context.extensionPath, 'jars/language-server.jar')
                ];
                const toolsJar = commons.findJvmFile('lib', 'tools.jar');
                if (toolsJar) {
                    classpath.push(toolsJar);
                } else {
                    VSCode.window.showWarningMessage('JAVA_HOME environment variable points either to JRE or JDK missing "lib/tools.jar" hence Boot Hints are unavailable');
                }
                return classpath;
            },

    There is however no comment explaining the need for tools.jar.

  6. martinlippert commented on Dec 27, 2017

    @martinlippert
    Member

    @martinborgman we use the JMX remote management implementation of the JDK to connect to the running boot app and to get data from the actuators on those projects, therefore the need for us to use the tools.jar library of the JDK (which contains the code for the remote management agent stuff). JDK9 is different (due to the module system), so the message for the user is definitely misleading and we should fix that.

    In case you don't see any live hovers, you should make sure that you have the Spring Boot actuators included in your project. If that is the case, but live hovers still aren't showing up, we need to investigate this further.

    Next step would be to check if you could connect to the running Spring Boot application using "jconsole". Does that work for you?

    If that doesn't work, you might hit a network config case that makes it hard for the language server to connect to the app via JMX. You could try to add -Djava.rmi.server.hostname=localhost as a VM param to the launch config of your Spring Boot app and start it again. Does that make a difference?

  7. khe817 commented on Dec 27, 2017

    @khe817
    Author

    Confirmed working without having to copy lib/tools.jar over despite error message showing up on start up.

    Boot Hint however interferes with redhat.java plugin (Language support for Java by Red Hat) somehow. It makes redhat.java run slow, and code complete no long work.

    Boot Hint works fine along side with redhat.java plugin with java JDK 1.8.x.

  8. martinborgman commented on Dec 27, 2017

    @martinborgman

    @martinlippert I was only commenting on where the error came from.

    That said, I played some more with both Java 8 as Java 9 and at first neither worked because the test project I was using did not contain Spring Boot actuators. It now works fine with Java 8.
    With Java 9 not all things work, for example I was unable to lookup the runtime endpoints. And as @khe817 mentions, many things are slower when using Java 8.

    As for the connecting to a running application, it works the same as running the application inside vscode.

    I currently don't have a tools.jar file in Java 9 lib directory.

  9. martinborgman commented on Dec 27, 2017

    @martinborgman

    I probably should make a new issue regarding Spring Boot 2.0 and actuator, because that is what is causing my Java 9 endpoints not showing issue.

  10. spring-projects-issues commented on Dec 28, 2017

    @spring-projects-issues

    (comment in Pivotal Tracker added by Martin Lippert:)

    there is a separate story about improving the warning about the missing tools.jar (to not show that one up when running on JDK9): #153612030.

    This ticket should be used to investigate the described slowdown when running on JDK9 (in combination with the RedHat Java Language extension).

  11. moyodiallo commented on Jan 24, 2018

    @moyodiallo

    I think , you can fixe it like this:
    copy all files in java-1.8.0-openjdk-amd64/lib to java-1.8.0-openjdk-amd64/jre/lib

  12. inodb commented on Jan 25, 2018

    @inodb

    on OSX my JAVA_HOME was pointing to an old version when i got the same error. I get that this issue is actually different, but google did bring me here, so just sharing what worked for me (JDK version 8):

    # input jdk dir
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/ 
    launchctl setenv JAVA_HOME $JAVA_HOME
    # need to restart vscode for this to work
    
  13. martinlippert commented on Jan 30, 2018

    @martinlippert
    Member

    we improved the way the tools.jar is being found in the next milestone update release (M8), therefore I am going to close this issue here.

    The slowness when running on JDK9 that got mentioned in a few comments got moved to its own issue here: #36

  14. added this to the 4.0.0.M8 milestone on Jan 30, 2018
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