[SOLVED] 'javac' is not recognized as an internal or external command

A6TH

Distinguished
Oct 16, 2013
104
0
18,690
After installing JDK on my Windows 10 machine, I can't seem to set it up so I can run javac and java commands directly from command prompt. I've tried setting environment variables, restarting PC, but it didn't work either.
When I type the full path to javac.exe in command prompt and try to compile the program that way, it works, but when I try to run the program with 'java' command, I get an error:
"Could not find or load main class HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld"
 
Solution
I found out what the problem was. When setting environment variables, I added a new Path variable %JAVA_HOME%\bin to System variables, where JAVA_HOME was defined in my user variables pointing to Java installation path. However, changing %JAVA_HOME%\bin to the full path resolved the problem.

A6TH

Distinguished
Oct 16, 2013
104
0
18,690
I found out what the problem was. When setting environment variables, I added a new Path variable %JAVA_HOME%\bin to System variables, where JAVA_HOME was defined in my user variables pointing to Java installation path. However, changing %JAVA_HOME%\bin to the full path resolved the problem.
 
Solution

A6TH

Distinguished
Oct 16, 2013
104
0
18,690
I also added all the default environment variables that I didn't have (from online source - Computer Hope), but I don't think that's the reason why Java didn't work.