javac 在 Windows 命令提示符下不起作用 [英] javac not working in windows command prompt

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

问题描述

我正在尝试在 Windows 命令提示符下使用 javac,但它不起作用.

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

PATH环境变量末尾添加目录"C:Program FilesJavajdk1.6.0_16in"后,java 命令工作正常,但使用 javac 给我以下错误:

After adding the directory "C:Program FilesJavajdk1.6.0_16in" 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 filesjavajdk1.6.0_16in"

通过检查,执行:

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 filesjavajdk1.6.0_16injavac.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 类型操作系统中的 which 和/或 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天全站免登陆