Invalid runtime for JavaSE-19: The path points to a missing or inaccessible folder (/path/to/jdk-19)

huangapple go评论64阅读模式
英文:

Invalid runtime for JavaSE-19: The path points to a missing or inaccessible folder (/path/to/jdk-19)

问题

如何在VSCODE 1.75.1中解决此运行时错误?在Windows C:位置安装的JDK是jdk-19。

  • settings.json
{
  "java.configuration.runtimes": [
    {},
    {
      "name": "JavaSE-19",
      "path": "/path/to/jdk-19",
      "default": true
    }
  ],
  "workbench.colorTheme": "GitHub Dark Default",
  "security.workspace.trust.untrustedFiles": "open",
  "debug.onTaskErrors": "debugAnyway",
  "files.autoSave": "afterDelay",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "[c]": {
    "editor.defaultFormatter": "ms-vscode.cpptools"
  },
  "code-runner.runInTerminal": true,
  "[cpp]": {
    "editor.defaultFormatter": "ms-vscode.cpptools"
  },
  "editor.wordWrap": "on",
  "workbench.view.alwaysShowHeaderActions": true,
  "zenMode.fullScreen": false,
  "workbench.editor.untitled.hint": "hidden",
  "window.zoomLevel": 1,
  "editor.accessibilitySupport": "on",
  "java.jdt.ls.java.home": "c:\\Program Files\\Java\\jdk-19",
  "java.home": "c:\\Users\\Vindhya Sree\\.vscode\\Microsoft VS Code\\jdk-17"
}

我尝试设置环境变量并成功设置了JAVA_HOME位置。然后,我遇到了运行时错误的重复问题。我以前使用它们都很正常,因为我安装了VSCODE自带的Java扩展包以及JDK 17的先前版本,但在使用了几个月后,我收到了更新JDK到17+并根据此进行Java运行时配置的消息,但现在在相同的项目上不再起作用。

英文:

How do I fix this runtime error in VSCODE 1.75.1? The JDK installed is jdk-19 in Windows C: location.

  • settings.json
{
  "java.configuration.runtimes": [
  
    {},
    {
      "name": "JavaSE-19",
      "path": "/path/to/jdk-19",
      "default": true
    }
  ],
  "workbench.colorTheme": "GitHub Dark Default",
  "security.workspace.trust.untrustedFiles": "open",
  "debug.onTaskErrors": "debugAnyway",
  "files.autoSave": "afterDelay",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "[c]": {
    "editor.defaultFormatter": "ms-vscode.cpptools"
  },
  "code-runner.runInTerminal": true,
  "[cpp]": {
    "editor.defaultFormatter": "ms-vscode.cpptools"
  },
  "editor.wordWrap": "on",
  "workbench.view.alwaysShowHeaderActions": true,
  "zenMode.fullScreen": false,
  "workbench.editor.untitled.hint": "hidden",
  "window.zoomLevel": 1,
  "editor.accessibilitySupport": "on",
  "java.jdt.ls.java.home": "c:\\Program Files\\Java\\jdk-19",
  "java.home": "c:\\Users\\Vindhya Sree\\.vscode\\Microsoft VS Code\\jdk-17"
}

I tried setting the environment variables and successfully set JAVA_HOME location as well. After doing that, I have this recurring problem of runtime errors. I was using them normally as i installed the extension pack of Java from VSCODE itself and the previous version of JDK 17 but after a few months of programming with them, i got a message of updating the JDK to 17+ and configuring Java runtime as per the same and now after doing it all, it doesn't work on the same projects anymore.

答案1

得分: 0

"c:\Program Files\Java\jdk-19",
"c:\Users\Vindhya Sree\.vscode\Microsoft VS Code\jdk-17"

英文:

It seems you are using two different jdk, keep both same and try.

"java.jdt.ls.java.home": "c:\Program Files\Java\jdk-19",

"java.home": "c:\Users\Vindhya Sree\.vscode\Microsoft VS Code\jdk-17"

huangapple
  • 本文由 发表于 2023年2月18日 15:17:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75491786.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定