无效的 JavaSE-11 运行时:路径指向丢失或不可访问的文件夹。

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

Invalid runtime for JavaSE-11: The path points to a missing or inaccessible folder

问题

以下是翻译好的内容:

我的VSCode不再识别Java运行时的路径。我之前正常使用它们,现在在同样的项目上不起作用了。下面是错误信息和我的设置。运行时的路径是正确的。

环境:

  • 操作系统:Linux Mint 20 Cinnamon
  • JDK版本:Openjdk版本 "11.0.8" 2020年7月14日
  • Visual Studio Code版本:v1.49.2
  • Java扩展版本:v0.68.0

错误信息:

无效的 JavaSE-11 运行时:路径指向丢失或不可访问的文件夹。

  • settings.json:
    "java.home": "/usr/lib/jvm/java-11-openjdk-amd64",
    "java.configuration.runtimes": [
    
      {
        "name": "JavaSE-1.8",
        "path": "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java",
      },
      {
        "name": "JavaSE-11",
        "path": "/usr/lib/jvm/java-11-openjdk-amd64/bin/java",
        "default": true
      },
      {
        "name": "JavaSE-14",
        "path": "/usr/lib/jvm/java-14-openjdk-amd64/bin/java",
      },
    ],
英文:

My VSCode is no longer recognizing the paths of the java runtime. I was using them normally and now it doesn't work on the same projects anymore. Here are the error messages and my settings. The paths to the runtimes are correct.

Environment:

  • Operating System: Linux Mint 20 Cinnamon
  • JDK version: Openjdk version "11.0.8" 2020-07-14
  • Visual Studio Code version: v1.49.2
  • Java extension version: v0.68.0

Error:

无效的 JavaSE-11 运行时:路径指向丢失或不可访问的文件夹。

  • settings.json:
    "java.home": "/usr/lib/jvm/java-11-openjdk-amd64",
    "java.configuration.runtimes": [
    
      {
        "name": "JavaSE-1.8",
        "path": "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java",
      },
      {
        "name": "JavaSE-11",
        "path": "/usr/lib/jvm/java-11-openjdk-amd64/bin/java",
        "default": true
      },
      {
        "name": "JavaSE-14",
        "path": "/usr/lib/jvm/java-14-openjdk-amd64/bin/java",
      },
    ],

答案1

得分: 9

"The 'path'参数应设置为Java运行时目录的位置,而不是java可执行文件的位置。去掉末尾的“/bin/java”。"

英文:

The “path” parameter should be set to the location of the Java runtime directory, not to the java executable file. Take “/bin/java” off the end.

答案2

得分: 0

我不得不在路径末尾添加/Contents/Home

之前:
/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk

之后:
/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

在OS X 11.1和VS Code 1.52.1上。

英文:

I had to add /Contents/Home at the end of my path:

before:
/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk

after:
/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

on OS X 11.1 and VS Code 1.52.1.

huangapple
  • 本文由 发表于 2020年10月3日 01:11:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/64175677.html
匿名

发表评论

匿名网友

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

确定