Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger should use project's Java runtime to launch application #753

Closed
fbricon opened this issue Jan 28, 2020 · 2 comments · Fixed by #758
Closed

Debugger should use project's Java runtime to launch application #753

fbricon opened this issue Jan 28, 2020 · 2 comments · Fixed by #758
Assignees
Milestone

Comments

@fbricon
Copy link
Collaborator

fbricon commented Jan 28, 2020

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
  1. Have java.home to point to JDK 1.8
  2. 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"
        },
  1. create a Maven project targeting Java 11 (set <maven.compiler.source> and <maven.compiler.target> to 11)
  2. 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

@akaroml
Copy link
Member

akaroml commented Feb 7, 2020

This requires the debugger to follow the target platform specified in the project. @testforstephen please help prioritize this.

@akaroml
Copy link
Member

akaroml commented Feb 7, 2020

Related PR eclipse-jdtls/eclipse.jdt.ls#1307

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants