Andre
Andre

Reputation: 661

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

Upvotes: 2

Views: 12278

Answers (2)

Avnish Patel
Avnish Patel

Reputation: 41

You can also try to specify the full pathname.

Instead of

%JAVA_HOME%\bin

try

C:\Program Files\Java\jdk1.8.0_101\bin

This worked for me on Windows 10 64-bit Education Edition with Java 8.0.101

Upvotes: 4

t7bdh3hdhb
t7bdh3hdhb

Reputation: 438

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!

Upvotes: 7

Related Questions