英文:
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
错误信息:
- 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:
- 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论