Question: I've tried adding JAVA\_HOME with the directory - C:\Program Files\Java\jdk1.8.0\_121 to my system variables, and then adding %JAVA\_HOME%/bin to Path variable and this didn't work and I receive 

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

So I've tried adding C:\Program Files\Java\jdk1.8.0\_121; directly to the path variable but I still get the above error. Does anyone have any suggestions please?

Thanks

PS - The image shows me in the command prompt at C:\Program Files\Java\jdk1.8.0\_121 trying 'java -version' - I just moved up one dir to test the variable, entering 'java -version' in the bin directory returns the correct info, as you would expect.

[![Link to the image](https://i.stack.imgur.com/nONVL.png)](https://i.stack.imgur.com/nONVL.png)

Answer: 
Did you try closing that command prompt and reopening it?
In the command line, run the following:

`set PATH=%PATH%:C:\Program Files\Java\jdk1.8.0_121\bin`

Without exiting the shell, run your java commands

E.g. 

`java -version`

This will surely work.