Install Java in Windows
Install Java in Windows: Here’s a step-by-step guide to install Java on a Windows machine:
Step 1: Download Java Development Kit (JDK)
- Go to the Oracle JDK download page: Open your browser and navigate to the Oracle JDK download page.
- Select the JDK version: Choose the version you want to download (e.g., JDK 17 or JDK 11, which are popular versions).
- Download the installer: Click on the link for the Windows installer. It will typically be an
.exe
file.
Step 2: Install Java in Windows using JDK
- Run the installer: Once the download is complete, locate the
.exe
file and double-click to run it. - Follow the installation prompts:
- Click “Next” to start the installation.
- Choose the installation directory (the default is usually fine).
- Click “Next” and then “Install” to begin the installation process.
Step 3: Set up Environment Variables
- Open System Properties
- Right-click on “This PC” or “Computer” on the desktop or in File Explorer.
- Select “Properties.”
- Click on “Advanced system settings.”
- In the System Properties window, click on the “Environment Variables” button.
- Add JAVA_HOME variable:
- In the Environment Variables window, click “New” under the “System variables” section.
- Set the “Variable name” to
JAVA_HOME
. - Set the “Variable value” to the path of the JDK installation directory (e.g.,
C:\Program Files\Java\jdk-17
). - Click “OK.”
- Update the PATH variable:
- In the Environment Variables window, find the “Path” variable in the “System variables” section and select it.
- Click “Edit.”
- Click “New” and add
%JAVA_HOME%\bin
to the list. - Click “OK” to close all windows.
Step 4: Verify the Installation
- Open Command Prompt:
- Press
Win + R
, typecmd
, and press Enter to open Command Prompt.
- Press
- Check Java version
- Type
java -version
and press Enter. You should see the version of Java you installed. - Type
javac -version
and press Enter. You should see the version of the Java compiler.
- Type
If both commands show the correct version, Java is successfully installed on your system.
Additional Steps (Optional)
- Install an IDE: Consider installing an Integrated Development Environment (IDE) like IntelliJ IDEA, Eclipse, or NetBeans to make Java development easier.
That’s it! You now have Java installed on your Windows machine.