javac 在 Windows 7 中不被识别为内部或外部命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32155113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 12:05:23  来源:igfitidea点击:

javac is not recognized as an internal or external command in windows 7

javawindows

提问by Simran Kaur

I have set JAVA_HOME and PATH variable.

我已经设置了 JAVA_HOME 和 PATH 变量。

JAVA_HOME looks like this:

JAVA_HOME 看起来像这样:

C:\Program Files\Java\jdk1.8.0_60

PATH looks like this:

PATH 看起来像这样:

    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;

    "C:\Program Files\nodejs\" "C:\Program Files (x86)\Brackets\command";C:\mongodb\bin;"C:\Program Files\cURL\bin" ;C:\Python34\python.exe; 

"%JAVA_HOME%/bin" ;

Yet it can not find any of the java commands like javac or java,

但是它找不到任何 java 命令,如 javac 或 java,

User Path variable:

用户路径变量:

 C:\Program Files\nodejs\node_modules\npm\; C:\Users\dev4\AppData\Roaming\npm; C:\mongodb\bin; " %JAVA_HOME%\bin\" ; "%ANT_HOME%\bin\" ;

System path variable:

系统路径变量:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; C:\Program Files\nodejs\ ; C:\Program Files (x86)\Brackets\command;C:\mongodb\bin;C:\Program Files\cURL\bin ;C:\Python34\python.exe; %JAVA_HOME%\bin\;

Despite npm command is not working either.

尽管 npm 命令也不起作用。

These have been working before but since I was trying to set path for java , al of them have stopped working

这些以前一直在工作,但是自从我尝试为 java 设置路径以来,它们都已停止工作

回答by Subodh Joshi

Please use \backslashnot /forward slashThat is the issue in your Path setup

请使用\反斜杠而不是/正斜杠这是路径设置中的问题

enter image description here

在此处输入图片说明

EDIT :-

编辑 :-

  1. Right-click the My Computer icon on your desktop and select Properties.
  2. Click Advanced system settings link.
  3. Click the Advanced tab.
  4. Click the Environment Variables button.
  5. Under System Variables, click New.
  6. Enter the variable name as JAVA_HOMEEnter the variable value as the installation path for the Java Development Kit as C:\Program Files\Java\jdk1.8.0_60
  7. Now make entry for Pathvariable shown above image
  1. 右键单击桌面上的“我的电脑”图标,然后选择“属性”。
  2. 单击高级系统设置链接。
  3. 单击高级选项卡。
  4. 单击环境变量按钮。
  5. 在系统变量下,单击新建。
  6. 输入变量名作为JAVA_HOME输入变量值作为Java开发工具包的安装路径作为C:\Program Files\Java\jdk1.8.0_60
  7. 现在输入上Path图所示的变量

回答by ji2495

In my system, User variable path is as below

在我的系统中,用户变量路径如下

C:\apache-ant-1.9.5\bin;E:\Android\platform-tools;E:\Android\tools;C:\Users\M\AppData\Roaming\npm
C:\apache-ant-1.9.5\bin;E:\Android\platform-tools;E:\Android\tools;C:\Users\M\AppData\Roaming\npm

And my system path variable is

我的系统路径变量是

C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_45\bin;C:\Program Files\nodejs\

C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_45\bin;C:\Program Files\nodejs\

JAVA_HOME is

JAVA_HOME 是

C:\Program Files\Java\jdk1.8.0_45

C:\Program Files\Java\jdk1.8.0_45

Hope this helps.

希望这可以帮助。

回答by Kyrei

Don't do what I did and sit there wondering for an hour why the path isn't changing in your windows.

不要像我做的那样坐在那里想一个小时为什么你的窗户里的路径没有改变。

Change the Variable...

改变变量...

THEN RESTART YOUR PC

然后重启你的电脑

An hour I will never get back lost to not doing the first thing you should try.

一个小时我永远不会因为没有做你应该尝试的第一件事而迷失方向。