microsoft / microsoft/vscode-java-debug

Wrong Java runtime used JRE 11 vs. JRE 17

未关闭
#1,406 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

Wrong Java runtime used

Environment
  • Operating System: ubuntu linux
  • JDK version: Corretto-17.0.9.8.1
  • Visual Studio Code version: latest
  • Java extension version: latest and prerelease
  • Java Debugger extension version: latest and prerealease
Steps To Reproduce
  1. Trying to debug spring boot

No special launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Launch Application",
            "request": "launch",
            "mainClass": "de.xxx.xxx.Application",
            "projectName": "xxx-application",
            "env": {
                "SPRING_PROFILES_ACTIVE": "debug",
            },
            "vmArgs": "-Xms128m -Xmx128m"
        }
    ]
}

Java Configure Runtime for Projects outputs wrong java version

image

Should be 17 (works on other enviroments - E.g. eclipse)

Current Result
Error: Unable to initialize main class de.ewe.gisatfuture.servicehub.Application
Caused by: java.lang.UnsupportedClassVersionError: org/springframework/web/servlet/config/annotation/WebMvcConfigurer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Expected Result

Debugger should simply run

Additional Informations

Workaround: mvn spring-boot:run does work

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用所示的 launch.json 重现 Spring Boot 调试启动,并检查 Java Configure Runtime for Projects 的输出。将其中选择的 JRE 与 JDK 17 环境以及调试器使用的 runtime 进行比较。当调试器使用 JDK 17 而不是 JRE 11 启动应用程序时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, spring-boot, vscode
领域
devtools, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。