javac is not recognized as an internal or external command, operable program or batch file [closed]

The error javac is not recognized as an internal or external command, operable program or batch file occurs when you try to run the javac command from the command prompt, but the command prompt cannot find the javac executable.

There are a few possible causes for this error:

  1. javac is not in your system's PATH: The javac executable is not in a directory that is listed in your system's PATH environment variable. To fix this, you need to add the directory where javac is located to your PATH.

  2. You have multiple versions of Java installed: You might have multiple versions of Java installed on your system, and the command prompt is using a different version of Java than the one that contains the javac executable. To fix this, you need to update your PATH to point to the correct version of Java.

  3. You have a typo in the command: Make sure that you have typed the javac command correctly.

To add javac to your PATH, you need to do the following:

  1. Open the Start menu and search for "Environment Variables".
  2. Click on "Edit the system environment variables" button.
  3. Click on the "Environment Variables" button.
  4. In the "System Variables" section, scroll down and find the "Path" variable, and click on "Edit".
  5. Click on the "New" button and add the directory where javac is located.
  6. Click on "OK" to save the changes.

After adding javac to your PATH, you should be able to run the javac command from the command prompt.

I hope this helps! Let me know if you have any other