“java is not recognized”, explained and fixed

This Windows message means the terminal searched every folder on the PATH and found no java executable: Java is not installed, or it is installed but its bin folder is not on the PATH. It is an environment problem, not a problem with any program being run; the .jar file or application waiting on this command may be perfectly fine. The same failure appears for double-clicked jars that “do nothing”, since Windows launches them through the same lookup.

The fix, in order

  1. Check whether Java exists at all: look under C:\Program Files\Java and C:\Program Files\Eclipse Adoptium. An empty result means install a runtime: a JDK from Temurin, Oracle, or Amazon Corretto includes the java command (and the compiler), and is the right download for development and most launchers.
  2. Set JAVA_HOME to the install folder (not its bin subfolder) via Settings, “environment variables”, System variables.
  3. Add %JAVA_HOME%\bin to the System Path variable. Avoid adding the raw versioned path in both places; the variable keeps upgrades simple.
  4. Open a new terminal and run java -version. Existing windows retain the old environment and will keep failing, which is the most common reason people believe the fix “didn't take”.

Common wrinkles

  1. The program needs a specific version: servers and modded games often require a particular Java (8, 17, 21). If java -version works but the application still complains, install the required version and point that application (or JAVA_HOME) at it; multiple versions coexist fine.
  2. 32-bit versus 64-bit: old launchers tied to 32-bit Java fail in confusing ways on 64-bit installs; for modern software this is rarely the issue, but a legacy tool's documentation will say if it needs the 32-bit runtime.
  3. PATH edited under User instead of System: services and some launchers read the System variables; user-only entries work in your own terminal but not for them. Either scope works for interactive use.

Common questions

What is the difference between this and “javac is not recognized”? java is the runtime, javac is the compiler. If java works and javac does not, a runtime-only install or a partial PATH is present. If neither works, the whole JDK is missing from PATH. The setup steps are identical.

Why does the jar open in WinRAR or do nothing when double-clicked? The .jar file association points at an archive tool or at a java that cannot be found. Fixing the installation and PATH restores the association; jars can always be run explicitly with java -jar file.jar from a terminal.

I installed Java but the browser or game still says it is missing, why? Those checks often look at JAVA_HOME or their own settings rather than PATH. Set JAVA_HOME as above, restart the application fully, and check the application's own Java path setting if it has one.

Related errors

'javac' is not recognized · Could not create the Java Virtual Machine · Minecraft exit code 1