Utkarsh Sharma
Utkarsh Sharma

Reputation: 3

java command works but javac command doesn't?

I have downloaded the jdk 1.8.0_131

when I open the command prompt and write the following command - java -version it gives me the output

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

but when I write the following command: javac -version it gives me the output

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

I have edit the system variables path to - C:\Progra~1\Java\jdk1.8.0_131\bin;

and when I do the following command : "C:\Program Files\Java\jdk1.8.0_131\bin\javac" -version

it gives me the output:

javac 1.8.0_131

So i know I have installed the correct java version

I also checked the above folder and did find a javac.exe there. Please help.

Edit:

I finally solved the problem. What I was doing is editing the "Path" variable when what I had to do was make a new variable called "PATH" and the the following details :

Variable name  : PATH
Variable value : c:\Program Files\Java\jdk1.8.0_xx\bin;[Existing Entries...

Upvotes: 0

Views: 864

Answers (2)

Nurjan
Nurjan

Reputation: 6053

In Windows you need to add path to the jdk_your_version/bin to the PATH variable. Add this line to the PATH:

C:\Progra~1\Java\jdk1.8.0_131\bin;

Save it. Then restart CMD since it does not update the path automatically for the open cmd. Then you should be able to see that javac is working:

javac -version

Upvotes: 0

Gov
Gov

Reputation: 375

Have you tried restarting "cmd.exe" since adding the bin directory to your PATH?

If you confirm that your PATH includes the java bin directory and you can see the "javac.exe" binary in that location, then all should be set up correctly.

Upvotes: 1

Related Questions