简体   繁体   English

jdk 在终端中工作,但在 vs 代码中没有工作,这给了我错误

[英]The jdk is working in terminal but they not working in vs code it's give me error

When I run this command java --version still working in cmd terminal but they show me add your path java_home.当我运行这个命令 java --version 仍然在 cmd 终端中工作,但他们告诉我添加你的路径 java_home。 I'm not sure why give me this error.我不知道为什么给我这个错误。 I'm using vs code我正在使用 vs 代码

This happens because of the configuration settings setup.发生这种情况是因为配置设置设置。 Inside settings.json try adding the path of the jdk and try again在settings.json里面试试添加jdk的路径再试试

Open the command palette (either with F1 or Ctrl+Shift+P) Type "open settings" You are presented with two options, choose "Open Settings (JSON)" Then add the below command打开命令面板(使用 F1 或 Ctrl+Shift+P)键入“打开设置”您会看到两个选项,选择“打开设置(JSON)”然后添加以下命令

{
     ...
    "java.home": "/usr/share/java/jdk-11.0.4",
     ...

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM