JAVA_Home should be right but still shows "Note Java 8 can still be used in your own projects"
See original GitHub issueDescribe the bug
I think my Java setup in my Visual Studio Code should be right. But this extension still show me this:
Spring Tools Language Server requires Java 11 or higher to be launched. Current Java /usr/lib/jvm/java-8-openjdk-amd64/bin/java. (Note Java 8 can still be used in your own projects. Java 11 is only required to launch the Spring Tools Language Server process)
Source: Spring Boot Tools (Extension)
To Reproduce
-
Initialize a Spring Boot project using this:
https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.5.3&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=lombok,web
-
Use `Remote-SSH: Connect to Host…’ open Spring Boot project
-
Open MAVEN view in EXPLORER, expand
demo
node, click the+
sign in the Dependencies noe -
Search for
spring-boot-starter-validation
, choose theorg.springframework.boot
one. -
The VSCode will show this message immediately.
-
My
JAVA_HOME
should be right. -
The VSCode setting is empty.
Sample
Here is my sample project:
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
JAVA_HOME should point to a JDK not a JRE - Stack Overflow
I added JAVA_HOME path in user variable and omit the "/bin". I tried every method given here but ...
Read more >Maven Error “JAVA_HOME should point to a JDK not a JRE”
In this tutorial, we're going to talk about an exception that Maven throws when misconfigured: JAVA_HOME should point to a JDK, not a...
Read more >Language Support for Java(TM) by Red Hat
Extension for Visual Studio Code - Java Linting, Intellisense, formatting, refactoring, Maven/Gradle support and more...
Read more >Blog - Spring
... (VS Code, Spring Boot) fixed: JAVA_Home should be right but still shows “Note Java 8 can still be used in your own...
Read more >About Upgrading to Java 11 for VS Code for Java
This is NOT a requirement to your project. That means, you can continue developing your project with version 1.5 or above. Behind scene,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The error message that you mentioned above looks like the Spring Boot Tools extension is picking up a JDK8 to run the language server process (a tooling-internal process, not related to your projects), but it needs JDK11. I don’t exactly know why the JDK8 is selected instead of the JDK11 that you have in your JAVA_HOME environment variable… 😦
In case this problem persists, you can specify which JDK the Spring Boot tools should use internally (again, just internally, not for your project) via the settings:
"spring-boot.ls.java.home": "/usr/lib/jvm/java-11-openjdk-amd64/bin/java"
(or whatever the right path to the Java executable of your JDK11 install is)
This is covered by the latest changes, I think, which is looking at the STS4 specific property first and tries
java.home
next, if the STS4 property is not set or not set to an existing JDK.