How to set path in Java
PATH is how your computer finds java and javac. If PATH is wrong, the terminal says the command is not recognised. This is a setup topic, not a coding topic — but labs and viva ask it.
Install a JDK (not only JRE if you want to compile). Inside the JDK folder, bin has java and javac. Add that bin folder to PATH. Many tools also want JAVA_HOME pointing at the JDK root folder.
Open a new terminal after you change PATH — the old window still uses the old PATH. Then run java -version and javac -version. If javac is missing, you installed JRE only, or PATH is wrong.
Let's take this on the board with one tiny Main class — no extra files. How to set path in Java — reads JVM properties — proves your runtime is available. Start from main, go line by line, and stop at each print. That output is the proof for How to set path.
JDK folder
│
▼
bin / java + javac
│ add to PATH
▼
java -versionPATH finds the tools. JAVA_HOME is the JDK folder. Then show java -version and javac -version.