Home java “javac” is not an internal or external command

“javac” is not an internal or external command

Author

Date

Category

When compiling the code via the command line, using the javac command, the following error is issued

 enter image description here

The path to bin is registered. Everything seems to be correct, but it still gives an error. What could be the matter?


Answer 1, authority 100%

Cause of error – Incorrect “environment variables” were set. Accordingly, you must specify the correct ones.

On your desktop, open This PC:

  1. Click on the top left “Properties”, then on the left in the menu –
    Advanced System Settings.
  2. In the “Advanced” tab that opens, at the very bottom, select
    Environment Variables.
  3. Content will open. Click “Create” in each window one by one.
  4. In the New User Variable window, write CLASSPATH.
  5. Then, in the New System Variable window, specify the PATH variable. V
    in the “Value” field, specify the directory for the JDK package.
  6. Restart Windows.

Alternatively, to run Javac, you can specify the full path to the console on the command line. For example: C: \ Program Files \ Java \ jdk1.8.0_102 \ bin \ javac.exe "MyFile.java

Source


Answer 2, authority 14%

If it didn’t help, adding to the CLASSPATH, then add the same path to the PATH, if there is already something there, add a semicolon ‘;’


Answer 3

If nothing has changed after adding the paths, then make copies of the jdk folders in Programm Files / java and Programm Files (x86) / java


Answer 4

A small addition, we write the path in variables to the bin folder, otherwise it will not work. Example:

C: \ Program Files \ Java \ jdk1.8.0_201 \ bin

You probably won’t need to reboot, but be sure to restart the command line.


Answer 5

It is necessary to move JAVA_HOME to the very beginning of the PATH variable so that it is before the standard path that was registered during installation:

C: \ Program Files (x86) \ Common Files \ Oracle \ Java \ javapath

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions