-
Notifications
You must be signed in to change notification settings - Fork 410
Closed
Description
Debugger uses the java.home version used to start jdt.ls, instead of the project's target JDK.
Environment
- Operating System: MacOS
- JDK version: any
- Visual Studio Code version: 1.41.x or 1.42.0-insider
- Java extension version: 0.56.0
- Java Debugger extension version: 0.24.0
Steps To Reproduce
- Have java.home to point to JDK 1.8
- Have Java 11 installed in /Library/Java/JavaVirtualMachines/ on a Mac, or use vscode-java 0.56.0 and set
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/path/to/jdk-11"
},- create a Maven project targeting Java 11 (set
<maven.compiler.source>and<maven.compiler.target>to 11) - run a main class
Current Result
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/acme/GreetingResource has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Expected Result
Program should run using the JDK version set for the given project, without any errors