Installing JDK
The Java Development Kit (JDK) is an essential tool for developing Java applications, including Spring Boot projects. Here's a step-by-step guide to installing the JDK on different operating systems.
Windows
-
Download Installer: Visit the official Oracle website to download the Windows installer for JDK. Alternatively, you can use open-source distributions like AdoptOpenJDK.
-
Run Installer: Double-click the downloaded
.exefile to start the installation process. Follow the on-screen instructions to complete the installation. -
Set Environment Variable:
- Right-click on 'My Computer' or 'This PC' and select 'Properties'.
- Click on 'Advanced system settings' and then 'Environment Variables'.
- Add a new system variable with the name
JAVA_HOMEand the value as the path to your JDK installation, e.g.,C:\Program Files\Java\jdk-11.
-
Update PATH: Edit the
PATHsystem variable to include%JAVA_HOME%\bin.
macOS
-
Download Installer: Visit the official Oracle website and download the macOS
.dmginstaller. -
Run Installer: Open the downloaded
.dmgfile and drag the JDK into the Applications folder. -
Set Environment Variable: Open Terminal and add the following line to your
.bash_profileor.zshrcfile.export JAVA_HOME=$(/usr/libexec/java_home)
Linux
-
Download Installer: Download the Linux
.tar.gzfile from the official Oracle website. -
Extract Archive: Open Terminal and run the following command to extract the downloaded archive.
tar -xvf jdk-11.tar.gz -
Move to Installation Directory: Move the extracted folder to
/usr/lib/jvm/.sudo mv jdk-11 /usr/lib/jvm/ -
Set Environment Variable: Open
.bashrcor.zshrcand add the following lines.export JAVA_HOME=/usr/lib/jvm/jdk-11 export PATH=$PATH:$JAVA_HOME/bin
After completing these steps, open a new terminal window and run java -version to verify that the JDK has been successfully installed.
Book a conversation with us for personalize training today!
