Resolving Javac Not Working
Resolving Javac Not Working
This document outlines the steps to fix the error "javac is not recognized as an internal
or external command" you encounter when compiling Java code.
This error arises when your command prompt (or terminal) cannot locate the javac
compiler, a crucial tool for compiling Java source code. Two primary reasons can
cause this:
1. Missing JDK Installation: The Java Development Kit (JDK) provides javac within
its bin directory. If the JDK is not installed, javac is unavailable.
2. Incorrect Path Configuration: Even with a JDK installation, the command
prompt might struggle to find javac if the path to the JDK's bin directory isn't set
in your system's environment variables.
If you get the error: ‘java’ is not recognized as an internal or external command,
Windows:
• Open explorer.
• Under "System variables," find the variable named "Path" and click "Edit."
• Check if the path to your JDK's bin directory is showing. Something like this:
C:\Program Files\Java\jdk21.0.2\bin