+1 vote
in I only have text by (4.6k points)

When I wanted  to compile my Test.java to Test.class file using the "javac Test.java" in CMD, it gave this error:

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

I have setted up the system variables for jdk, but not sure whether it's right or not.

1 Answer

0 votes
by (21.2k points)
 
Best answer

This error message is mostly because you didn't set the system environment variables correctly for your JDK, please follow the steps below to reset it again:

  1. Go to System Properties -> Environment Variables... -> System variables
  2. Click New... -> name: JAVA_HOME -> value: D:\Program Files\Java\jdk1.8.0_20 (your own dir) -> OK
  3. Double click the Path (extisting variable) -> add the following strings at the end:
    • ;%JAVA_HOME%\bin; (note the colon)
  4. Click New... -> name: CLASSPATH -> value: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOM E%\lib\tools.jar; (note the dot and colon) -> OK

That's all. Congratulations!

Welcome to Best solution for PC & Software errors, where you can ask questions and receive answers from other members of the community.
...