You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
The message comes from a test in vscode-extensions/vscode-boot-java/lib/Main.ts
classpath: (context: VSCode.ExtensionContext)=>{constclasspath=[Path.resolve(context.extensionPath,'jars/language-server.jar')];consttoolsJar=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');}returnclasspath;},
There is however no comment explaining the need for tools.jar.
@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?
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.
@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.
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
Activity
martinlippert commentedon Dec 25, 2017
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?
martinborgman commentedon Dec 25, 2017
As far as I can tell an empty tools.jar works just as well
BoykoAlex commentedon Dec 25, 2017
@khe817 are you trying the latest
0.1.2version? Is JDK 9.0.0 working?BoykoAlex commentedon Dec 25, 2017
Ok, I have just tried 0.1.2. Boot hints should work with Java 9.0.1 regardless of the message:
No need to copy
tools.jar. It doesn't look properly fortools.jarin Java 9 and hence shows the message but it still usestools.jar. We should just correct the lookup fortools.jarfor java 9 not to show the message that's all. It works regardless of the message.martinborgman commentedon Dec 25, 2017
The message comes from a test in vscode-extensions/vscode-boot-java/lib/Main.ts
There is however no comment explaining the need for tools.jar.
martinlippert commentedon Dec 27, 2017
@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=localhostas a VM param to the launch config of your Spring Boot app and start it again. Does that make a difference?khe817 commentedon Dec 27, 2017
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.
martinborgman commentedon Dec 27, 2017
@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.
martinborgman commentedon Dec 27, 2017
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.
spring-projects-issues commentedon Dec 28, 2017
(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).
moyodiallo commentedon Jan 24, 2018
I think , you can fixe it like this:
copy all files in
java-1.8.0-openjdk-amd64/libtojava-1.8.0-openjdk-amd64/jre/libinodb commentedon Jan 25, 2018
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):
martinlippert commentedon Jan 30, 2018
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