javac无法在Windows命令提示符下工作 [英] javac not working in windows command prompt

查看:150
本文介绍了javac无法在Windows命令提示符下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Windows命令提示符 javac ,但它无效。

I'm trying to use javac with the windows command prompt, but it's not working.

之后将目录C:\Program Files \Java \jdk1.6.0_16 \ bin \添加到 PATH的末尾环境变量, java 命令工作正常,但使用 javac 给出了以下错误:

After adding the directory "C:\Program Files\Java\jdk1.6.0_16\bin\" to the end of the PATH environment variable, the java command works fine, but using javac gives me the following error:


'javac'未被识别为内部或外部命令,可运行程序或批处理文件。

'javac' is not recognized as an internal or external command, operable program or batch file.


推荐答案

如果在命令提示符打开时将其添加到控制面板中,则不会影响当前的命令提示符。您需要退出并重新打开或只是执行:

If you added it in the control panel while your command prompt was open, that won't affect your current command prompt. You'll need to exit and re-open or simply do:

set "path=%path%;c:\program files\java\jdk1.6.0_16\bin"

通过检查,执行:

echo %path%

从命令提示符处告诉我们它是什么。

from your command prompt and let us know what it is.

否则,请确保 是一个javac在该目录中尝试:

Otherwise, make sure there is a javac in that directory by trying:

"c:\program files\java\jdk1.6.0_16\bin\javac.exe"

从命令提示符处。您还可以通过命令告诉使用哪个可执行文件(如果有):

from the command prompt. You can also tell which executable (if any) is being used with the command:

for %i in (javac.exe) do @echo %~$PATH:i

这是一个巧妙的把戏类似于某些UNIX类型操作系统中的 和/或 whence 命令。

This is a neat trick similar to the which and/or whence commands in some UNIX-type operating systems.

这篇关于javac无法在Windows命令提示符下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆