Coder Social home page Coder Social logo

Comments (13)

moyodiallo avatar moyodiallo commented on May 18, 2024 1

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

from sts4.

martinlippert avatar martinlippert commented on May 18, 2024

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?

from sts4.

martinborgman avatar martinborgman commented on May 18, 2024

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

from sts4.

BoykoAlex avatar BoykoAlex commented on May 18, 2024

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

from sts4.

BoykoAlex avatar BoykoAlex commented on May 18, 2024

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.

from sts4.

martinborgman avatar martinborgman commented on May 18, 2024

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.

from sts4.

martinlippert avatar martinlippert commented on May 18, 2024

@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?

from sts4.

khe817 avatar khe817 commented on May 18, 2024

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.

from sts4.

martinborgman avatar martinborgman commented on May 18, 2024

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

from sts4.

martinborgman avatar martinborgman commented on May 18, 2024

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.

from sts4.

spring-projects-issues avatar spring-projects-issues commented on May 18, 2024

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

from sts4.

inodb avatar inodb commented on May 18, 2024

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

from sts4.

martinlippert avatar martinlippert commented on May 18, 2024

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

from sts4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.