HarryQ
HarryQ

Reputation: 1423

VSCode Unbound classpath container JRE System Library [JavaSE-15]

I have been programming a java project using JDK14 and VSCode. Recently JDK15 is available, and I switched to the JDK. As for configuration, I pointed the VScode java.home and system JAVA_HOME to the new JDK folder.

When I clear the VSCode cache and restart the IDE, I started receiving this error

{
"resource": "/E:/dev/java/challenges/",
"owner": "_generated_diagnostic_collection_name_#3",
"code": "963",
"severity": 8,
"message": "Unbound classpath container: 'JRE System Library [JavaSE-15]' in project 'challenges'",
"source": "Java",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
} 

I have seen similar questions/answers, but none of them was directed to VSCode.

Screen shot on the error

Upvotes: 3

Views: 14545

Answers (4)

andrew-e
andrew-e

Reputation: 732

I was running into this message when building a Flutter app for Android from a Linux machine. I had texted out using JDK 23 on my OS, but switched back to JDK 21 and uninstalled version 23. For me, I was able to search for and edit a config file so it now says JavaSE-21.

$ cd ~/.config/VSCodium/
$ grep -ri javase-23 User/workspaceStorage/
./User/workspaceStorage/a14279ca6ec2572eff460add97355854/redhat.java/jdt_ws/.metadata/.plugins/org.eclipse.core.resources/.projects/app/.classpath: <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-23/"/>
./User/workspaceStorage/a14279ca6ec2572eff460add97355854/redhat.java/jdt_ws/.metadata/.log:!MESSAGE Setting /usr/lib64/jvm/java-23-openjdk-23 as 'JavaSE-23' environment (id:1736359803078)
...

In this case, I edited the first result and restarted VSCodium / VSCode.

Upvotes: 0

Wisnu Wijokangko
Wisnu Wijokangko

Reputation: 2318

I am new to building Java apps in VSCode. In my case, I was developing a microservice using Spring Boot. Here is what I've done to solve the issue ;

  1. Make sure JAVA_HOME env variable is registered to the right path
  2. Configured JDK path in java.jdt.ls.java.home to settings.json located inside .vscode. Here is my configuration.
{
    "java.configuration.updateBuildConfiguration": "automatic",
    "java.compile.nullAnalysis.mode": "automatic",
    "java.jdt.ls.java.home": "/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home"
}
  1. Restart the VSCode

Upvotes: 2

user1005462
user1005462

Reputation: 332

https://stackoverflow.com/a/42525941/1005462 this one was helpfull;

replace : build block in POM to

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Upvotes: 3

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9511

According to VsCode-Java in Twitter, JDK15 support won't be released until the end of September, and here is a github issue that's related to Java 15 not support.

Upvotes: 2

Related Questions