0

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...
3
  • You probably have not declared the CLASSPATH variable. Refer this link Commented Jun 19, 2017 at 3:03
  • Hope you have reopened the bash and tried this. Because the changes in path setting affect only in newly opened bash/shell Commented Jun 19, 2017 at 3:04
  • 2
    Gandalf: that is nonsense. Commented Jun 19, 2017 at 3:15

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I think my path is right. when i do the command echo %PATH% I get the output - "C:\Progra~1\Java\jdk1.8.0_131\bin;";C:\ProgramData\Oracle\Java\javapath; and so on
@UtkarshSharma If you do dir C:\Progra~1\Java\jdk1.8.0_131\bin\*.exe does it list javac.exe?
Yeah it gives javac.exe: 11/06/2017 10:56 PM 15,904 javac.exe
@UtkarshSharma Not sure if you pasted that PATH correctly, because there should be no " characters in it, so that could be your problem.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.