# Step 1: Download JDK
Go to the official Oracle website (https:
# Step 2: Run the installer
Once the JDK installer is downloaded, run it and follow the installation wizard.
# Step 3: Set up environment variables (PATH and JAVA_HOME)
After the installation is complete, you need to set up the environment variables.
- For Windows:
- Go to Control Panel -> System -> Advanced system settings.
- Click on the "Environment Variables" button.
- In the "System Variables" section, click "New" and add the following:
- Variable name: JAVA_HOME
- Variable value: <path to JDK installation directory> (e.g., C:\Program Files\Java\jdk-11.0.11)
- In the "System Variables" section, find the "Path" variable and click "Edit".
- Add the following entry to the list of paths:
- %JAVA_HOME%\bin
- Click "OK" to save the changes.
- For macOS or Linux:
- Open a terminal and enter the following command:
- nano ~/.bashrc
- Add the following line at the end of the file:
- export JAVA_HOME=<path to JDK installation directory> (e.g., /usr/lib/jvm/java-11.0.11)
- Save the file and exit the text editor.
- Run the following command to apply the changes:
- source ~/.bashrc
# Step 4: Verify the installation
To verify if the JDK installation was successful, open a new terminal/cmd and execute the following command:
java -version
If the installation was successful, you should see the JDK version displayed.
# Step 5: Start using JDK
Now you have successfully installed JDK on your system. You can start developing and running Java applications.