question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JAVA_Home should be right but still shows "Note Java 8 can still be used in your own projects"

See original GitHub issue

Describe 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

  1. 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
    
  2. Use `Remote-SSH: Connect to Host…’ open Spring Boot project

  3. Open MAVEN view in EXPLORER, expand demo node, click the + sign in the Dependencies noe

  4. Search for spring-boot-starter-validation, choose the org.springframework.boot one.

  5. The VSCode will show this message immediately.

    image

  6. My JAVA_HOME should be right.

    image

  7. The VSCode setting is empty.

    image

Sample

Here is my sample project:

https://github.com/doggy8088/spring-boot-demo

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
martinlippertcommented, Aug 9, 2021

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)

0reactions
martinlippertcommented, Aug 16, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found