镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Setting a different jdk version in settings.json (workspace) #1431

Closed

Description

@n8s16
Environment
  • Operating System: Windows 10
  • JDK version: Multiple JDK (Java Home is Java1.8)
  • Visual Studio Code version: 1.44.2
  • Java extension version: 0.61.0
Steps To Reproduce
  • I created a simple java hello world project.
  • I setup my java.home in settings.json (workspace) to
{
    "java.home": "C:\\Program Files\\Java\\jdk11.0.2",
    "java.configuration.runtimes": [
        {
          "name": "JavaSE-1.8",
          "path": "C:\\Program Files\\Java\\jdk1.8.0_121",
        },
        {
          "name": "JavaSE-11",
          "path": "C:\\Program Files\\Java\\jdk11.0.2",
          "default": true
        }
      ]
}

because I want to use Java11.

  • Java version in my environmental variables is set to C:\\Program Files\\Java\\jdk1.8.0_121.

As per the instruction posted here: https://github.com/redhat-developer/vscode-java#setting-the-jdk, vscode will use the workspace settings.json.

But when I tried running/debugging my application it has an error:

$  C:\Users\userX\.vscode\extensions\vscjava.vscode-java-debug-0.25.1\scripts\launcher.bat "C:\Program Files\Java\jdk1.8.0_121\bin\java.exe" -agentlib:jdwp=transport=dt_socket,server=ntlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:54576 -Dfile.encoding=UTF-8 -cp C:\test\test-java11\bin app.App
bash: C:UsersuserX.vscodeextensionsvscjava.vscode-java-debug-0.25.1scriptslauncher.bat: command not found

Is this an existing issue or am I doing it wrong? Thank you!

Activity

  1. fbricon commented on May 4, 2020

    @fbricon
    Collaborator

    Sorry but running code is out of scope of vcode-java. As you probably saw when opening this ticket:

    IF YOUR ISSUE CONCERNS RUNNING/DEBUGGING JAVA CODE,
    PLEASE OPEN YOUR TICKET IN https://github.com/microsoft/vscode-java-debug/issues

  2. testforstephen commented on May 6, 2020

    @testforstephen
    Collaborator

    The debugger will use the corresponding JDK with your project file. Could you share the .classpath file of your project?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions