简体   繁体   中英

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

I have set JAVA_HOME and PATH variable.

JAVA_HOME looks like this:

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

PATH looks like this:

    %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,

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.

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

Please use \\ backslash not / forward slash That is the issue in your Path setup

在此输入图像描述

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_HOME Enter 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 Path variable shown above image

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.

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 

And my system path variable is

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

JAVA_HOME is

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

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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