简体   繁体   English

VSCode 'java' 不是内部或外部命令,也不是可运行的程序或批处理文件

[英]VSCode 'java' is not recognized as an internal or external command, operable program or batch file

As the title says, I get the following error when I try to run Java commands in the VSCode terminal:正如标题所说,当我尝试在 VSCode 终端中运行 Java 命令时出现以下错误:

'java' is not recognized as an internal or external command, operable program or batch file. 'java' 不是内部或外部命令,也不是可运行的程序或批处理文件。

However, I am able to run these commands in my normal windows CMD, so I don't understand why it doesn't work in VSCode.但是,我能够在我的普通 Windows CMD 中运行这些命令,所以我不明白为什么它在 VSCode 中不起作用。

I have added the java bin path to the PATH environment variable.我已将 java bin 路径添加到 PATH 环境变量中。

Thanks in advance!提前致谢! :) :)

I had the same problem.我有同样的问题。 I share my experience it may work for you.我分享我的经验,它可能对你有用。

1- Firstly, you can install java package extension for VS Code, you can search it easily, find it in the extension in VS Code, and choose one of them to install. 1-首先,你可以安装VS Code的java包扩展,你可以很容易的搜索到,在VS Code的扩展中找到它,然后选择其中一个进行安装。

2- Another tricky thing happened for me is that, if you use terminals in VS Code, after changing environmental variables or installing new extension, it's better to restart the computer, then open the VS Code, kill the current terminal tab and open a new one and try the java -version command again. 2- 对我来说另一个棘手的事情是,如果您在 VS Code 中使用终端,在更改环境变量或安装新扩展后,最好重新启动计算机,然后打开 VS Code,杀死当前终端选项卡并打开一个新的java -version再次尝试java -version命令。

Regards问候

暂无
暂无

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

相关问题 'C:\Users\[UserName]' 不是内部或外部命令、可运行程序或批处理文件。 VsCode中的Java - 'C:\Users\[UserName]' is not recognized as an internal or external command, operable program or batch file. Java in VsCode 'java' 不是内部或外部命令、可运行程序或批处理文件 - 'java' is not recognized as an internal or external command, operable program or batch file 错误 -'javac' 不是内部或外部命令,也不是可运行的程序或批处理文件 - Error -'javac' is not recognized as an internal or external command, operable program or batch file 'cmd'未被识别为内部或外部命令,可操作程序或批处理文件 - 'cmd' is not recognized as an internal or external command, operable program or batch file 错误 - jar 不是内部或外部命令、可运行的程序或批处理文件 - Error - jar is not recognized as an internal or external command, operable program or batch file 'jar' 不是内部或外部命令、可运行程序或批处理文件错误 - 'jar' is not recognized as an internal or external command, operable program or batch file error 'appletviewer' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'appletviewer' is not recognized as an internal or external command, operable program or batch file 'wsgen'不被识别为内部或外部命令,可操作程序或批处理文件 - 'wsgen' is not recognized as an internal or external command, operable program or batch file 'scomp' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'scomp' is not recognized as an internal or external command, operable program or batch file 'mvn' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'mvn' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM