4

I've been trying to setup javac, but I keep getting the dreaded error message

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

Ive added the location of javac (C:\Program Files\Java\jdk1.7.0_17\bin) to the Path in Environment Variables.. restarted the console etc, but the error persists. Am I missing something here?

seeker
  • 6,841
  • 24
  • 64
  • 100
  • No. That question was because of a missing slash. My path is correct . – seeker Mar 24 '13 at 20:03
  • 2
    Shouldn't this be moved to [SuperUser](http://superuser.com)? – raptortech97 Mar 24 '13 at 20:04
  • 4
    does `echo %PATH%` in the console definitely include your location? separated by semicolon? without spaces before and after? And what does `for %i in (java.exe) do echo %~f$PATH:i` print in the console? – mihi Mar 24 '13 at 20:17
  • 1
    Thanks a lot for looking into it guys, a simple reboot fixed the issue! – seeker Mar 24 '13 at 21:47

2 Answers2

26

I had the same issue as yours and I've fixed like this:

In the system variables I made a new variable, called it JAVA_HOME, and I set the value to: C:\Program Files\Java\jdk1.7.0_17. After that, I edited Path, which is also in the system variables and I added : ;%JAVA_HOME%\bin.

I hope it will help you !

Survivor
  • 674
  • 1
  • 7
  • 13
  • this worked, thanks. some reason installing 21 with 15 and jre already installed caused this issue for win 8 64. – scape May 09 '13 at 00:12
1

The space in the path in Program Files is suspicious. Did you put this portion of the path in quotes?

You can also try where javac to see which javac is on the path. However, in this case, doesn't sound like it's getting picked up on the path anyway (it will probably also report that javac cannot be found).

John McCarthy
  • 5,752
  • 2
  • 29
  • 40