Trying to set up my JDK, when I enter "echo %JAVA_HOME%" it shows my JDK location but doesn't allow me compile any code

6912 views java

I've been to numerous sites and have made all the paths. When I type "echo %JAVA_HOME%" into the command, it shows the location as it's supposed to. But when I try and compile code it responds with "is not recognized as an internal or external command, operable program or batch file. I don't know much about how it's supposed to work and the internet doesn't seem to help.

answered question

What is the command you use to compile your code?

What you see in JAVA_HOME when you echo it?

Setting JAVA_HOME doesn't make Java available from the command-line. You don't need to set JAVA_HOME at all, just to run javac and java from the command-line. You need to add C:\path\to\java\bin to the PATH instead.

What is the output if you 'echo %PATH%'?

1 Answer


You need to configure your system path variable to your java's bin directory

For eg. my path variable is like:


OR you can do like


JAVA_HOME is variable which is used by other application like maven to refer JAVA home directory.

posted this

Have an answer?


Please login first before posting an answer.