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

From Maxent readme:

The problem is either that you don't have Java installed (you need to
install from java.sun.com as above), or Java is not mentioned in your
"path" variable. To fix the latter problem:

  1. From the desktop, right click My Computer and click properties.

  2. In the System Properties window, click on the Advanced tab.

  3. In the Advanced section, click the Environment Variables button.

  4. Finally, in the Environment Variables window, highlight the path
    variable in the Systems Variable section and click edit. Add the
    directory where the java executable is.

For example, if you downloaded Java 1.6.0_13, it was probably
installed in C:\Program Files\Java\jdk1.6.0_13, in
which case you will add ";C:\Program Files\Java\jdk1.6.0_13\bin" to
the end of the path variable, like in the following example:

C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\Program Files\Java\jdk1.6.0_13\bin

This error occurs usually when you try to compile a Java source file using javac command e.g. javac Helloworld.java and your PATH is not set properly. It means that javac.exe executable file, which exists in the bin directory of the JDK installation folder is not added to the PATH environment variable. In order to solve this error, you need to add JAVA_HOME/bin folder in your machine's PATH. Until your add Java into your system's PATH variable, you cannot compile and run Java program.

Just follow the steps given below to resolve your problem:

1) Just click on the Start button and open the command prompt and then type cmd on the run window.

2)  Type echo %PATH%,  it will now show you all the directories available in the PATH environment variable. The PATH output that you will receive, just copy it into your text editor e.g. Notepad or Word-pad and search if it contains the JDK installation directory or JAVA_HOME. Just take an example: Suppose if your JDK is installed on "c:\program files\java\jdk1.8.0", then PATH must include "c:\program files\java\jdk1.8.0\bin". It's important to include bin directory because all executable required to compile, run and debug Java program are stored in the bin directory.  Sometimes you may also see something like %JAVA_HOME%\bin , where JAVA_HOME is another user-defined environment which points to Java installation directory. 

3) If PATH doesn't contain bin directory of JDK, then you can add them into PATH by the following command

set PATH = %PATH%;"c:\program files\java\jdk1.8.0\bin

This is also called setting PATH in Java. Once PATH is set you can compile, run and monitor Java programs by using various tools that come with JDK installation.

4) Now, just run the javac command again and do not forget to close the current command prompt.  Any change in the environment variable is only available to new cmd windows.

Javac is not recognized - Quick Fix

Java is not recognized as an internal or external command ?. Here are the step by step procedure on how to reproduce the issue Java is not recognized as an internal or external command or 'javac' is not recognized as an internal or external command, operable program or batch file or 'java' is not recognized as an internal or external command, operable program or batch file. and fix the same.



Step By Step Procedure to Reproduce java is not recognized error

There could be many possibilities behind Java in not recognized error, here are the steps you can try to reproduce.

  1. On windows, Click on Start, then type cmd, and hit Enter. You will now get a command prompt screen. Type "java" or "java -version and enter", you will get Java is not recognized as an internal or external command, operable program or batch file error. This happens if the Installed java in not set properly.
  2. C:\Users\Techoral> java
    'java' is not recognized as an internal or external command, operable program or batch file.

  3. Your can also try to Run javac command to compile a java program from command line, you will get Javac is not recognized as an internal or external command ERROR if the installed java is not being set properly.
  4. C:\Users\Techoral> javac 'javac' is not recognized as an internal or external command, operable program or batch file.


Here are the steps to reslove the error:

  1. Check the Java path environment variable and makes sure that Java path is properly set.
  2. If Java Path is not set, copy the path to Java bin directory go to System Properties --> System Variables and add the java bin folder path.
  3. If you are still facing the issue, you can try reinstalling the java
  4. Before installing make sure to uninstall previously installed Java. Refer Uninstall Java on Windows or if you are using linux / ubuntu please refer Uninstall Java on linux / ubuntu
  5. Once java is completly uninstalled, download and install Oracle / OpenJDK / zulu :
      1. install openjdk on redhat
      2. install adoptopenjdk
      3. install zulu openjdk
      4. install Microsoft openjdk

More details about this Bug in OpenJDK -



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

Register for a free code camp.
email:

How do you fix Java is not recognized as an internal or external command operable program or batch file?

Here are the three easiest ways to fix Java's “not recognized as an internal or external command” error:.
Install or reinstall Java and the JDK on your computer..
Add Java's bin directory to the computer's PATH..
Restart the command prompt, terminal window or PowerShell..

Why does my computer not recognize Java?

The Java is not recognized as an internal or external command in Command Prompt error occurs if the environment variables are not configured correctly. By adding the correct path to an environment variable, you can resolve the issue. If the error persists, try installing the compatible Java version.

How do I add Java to my path in Windows 10?

Windows.
In Search, search for and then select: System (Control Panel).
Click the Advanced system settings link..
Click Environment Variables. ... .
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ... .
Reopen Command prompt window, and run your java code..