简体   繁体   中英

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

Cannot able to run my java program.

I have set the java path

set "path = C:\Program Files\Java\jdk-11.0.1\bin\javac.exe"

but its not working

C:\\Java Program>set "path = C:\\Program Files\\Java\\jdk-11.0.1\\bin"

C:\\Java Program>echo path path

C:\\Java Program>echo %path% C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Users\\GoAndroy Tech\\AppData\\Local\\Programs\\Git\\cmd;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Users\\GoAndroy Tech\\AppData\\Local\\Microsoft\\WindowsApps;

C:\\Java Program>javac 'javac' is not recognized as an internal or external command, operable program or batch file.

Do not set the path to executable directly. Instead set it to the directory that holds that binary. C:\\Program Files\\Java\\jdk-11.0.1\\bin\\ .

Set java path inside environment variables:

  • Go to Systems - > Advanced system settings -> Environment Variables
  • Click on Path in User variables. If Path User variable doesn't exists, then create one by clicking on New in User variables
  • Add C:\\Program Files\\Java\\jdk-11.0.1\\bin in Path edit environment variable by clicking on Edit button present on right palette.
  • click ok and exit.

Now, open a new command prompt and check using javac or javac -version .

You have to do like this

set path=%path%;C:\\Program Files\\Java\\jdk-11.0.1\\bin\\

see no space arround =


If you want to make this permanent

Open run dialog box and enter sysdm.cpl

go to advance tab -> envirnment variable and then edit the path in system variable

If you have windows 8 or later then

  • click on new and paste C:\\Program Files\\Java\\jdk-11.0.1\\bin\\

Or if you have windows 7 then

  • paste ;C:\\Program Files\\Java\\jdk-11.0.1\\bin\\

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