Search code examples
cmdenvironment-variablesjavac

java comand works but not javac?


ok so I got a new PC

Windows 7 Pro 64 bit Service Pack 1

I installed jdk-7u25-windows-x64 ( jdk 1.7.0_25)

It is installed in default location C:\Program Files\Java\jdk1.7.0_25

I set the JAVA_HOME environment variable to C:\Program Files\Java\jdk1.7.0_25

I added %JAVA_HOME%\bin to the Path environment variable (yes I used a ; before I added it)

Clicked Ok

Closed all CMD windows opened them up

And now If I run the command java I get the expected output

But If I run the javac command I get this

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

I have tried Fiddling with the path but no luck, and have restarted my PC etc. no luck

Also it seems to work if I am in the jdk\bin directory

C:\>cd C:\Program Files\Java\jdk1.7.0_25\bin

C:\Program Files\Java\jdk1.7.0_25\bin>javac -version
javac 1.7.0_25

C:\Program Files\Java\jdk1.7.0_25\bin>

how do I get javac command to run correctly like java is doing


Solution

  • I had previously problems with the path containing a blank. I would suggest to change the path from

    C:\Program Files\Java\jdk1.7.0_25
    

    to

    C:\Progra~1\Java\jdk1.7.0_25
    

    Hope this solves your problem!