To run Java programs, you must install the Java Development Kit (JDK) and configure the system PATH. This allows the operating system to recognize Java commands from any location.
javac and javaAfter installing the JDK, the system must know where Java is installed. This is done by adding the JDK bin directory to the PATH variable.
// Check installed Java version
java -version
If Java is installed correctly, the terminal will display the installed JDK version. If not, it will show an error indicating Java is not recognized.
java -versionjavac -version to verify