Installing JDK
Before you start writing Java programs, you need to install the JDK. You can download it from:
https://www.oracle.com/java/technologies/downloads/
Run the installer and follow the steps. It is recommended to install in the default directories. After installation, you need to configure the environment variables.
Environment variables can be set either via the command line or by following this path in the Windows GUI:
My Computer / Right-click -> Properties -> Advanced System Settings -> Environment Variables
Or search in Windows: Edit the system environment variables
Click on Environment Variables ->
- Edit the Path variable and add the path to the
binfolder inside the JDK installation directory. - Add a new system variable
JAVA_HOMEpointing to the JDK installation directory.
The paths to the respective folders can be easily copied in File Explorer (right-click on the folder path). To verify that Java is installed successfully, restart your computer, open Command Prompt, and enter the command java -version.