How to Install Java on Windows 11

1. Check If Java is Already Installed

java -version
javac --version

2. Download Java

Go to download page.

3. Install Java from downloaded .exe file

4. Configure Environment Variable

Start Menu -> Search -> Edit System Environment Variables -> Environment Variable -> NEW -> Enter "JAVA_HOME" and "PATH_TO_JDK"

5. Test in Command Prompt

echo %JAVA_HOME%
java -version
javac -version