What is JDK?
JDK (Java Development Kit) is a software development environment used for developing Java
applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader
(Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), and other tools
needed in Java development.
Installing JDK:
1. Go to the official Oracle website (https://www.oracle.com/java/technologies/javase-jdk15-
downloads.html) and download the latest version of JDK.
2. After downloading, open the installer and follow the instructions to install JDK on your
system.
3. Once installation is complete, verify the installation by opening a command prompt
(Windows) or terminal (Mac/Linux) and typing the following command:
java -version
javac -version
The output should display the version number of Java and javac, indicating that JDK is installed
properly.
Setting Up the Environment:
After installing JDK, the next step is to set up the environment. This involves setting the PATH and
JAVA_HOME variables.
Windows:
1. Right-click on "Computer" or "This PC" and select "Properties."
2. Click on "Advanced system settings" and then click on the "Environment Variables" button.
3. Under "User variables," click on "New" and add a variable named JAVA_HOME with the value
set to the installation path of JDK (e.g., C:\Program Files\Java\jdk-15.0.2).
4. Under "System variables," scroll down and find the PATH variable. Select it and click on
"Edit."
5. Add the following value in the "Variable value" field: %JAVA_HOME%\bin;
6. Click on "OK" to close all windows and save the changes.
Mac/Linux:
1. Open a terminal and open the .bash_profile or .zshrc file using a text editor (e.g., nano
~/.bash_profile).
2. Add the following lines to the file:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
Replace jdk-15.0.2 with the version number of JDK installed on your system.
JDK (Java Development Kit) is a software development environment used for developing Java
applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader
(Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), and other tools
needed in Java development.
Installing JDK:
1. Go to the official Oracle website (https://www.oracle.com/java/technologies/javase-jdk15-
downloads.html) and download the latest version of JDK.
2. After downloading, open the installer and follow the instructions to install JDK on your
system.
3. Once installation is complete, verify the installation by opening a command prompt
(Windows) or terminal (Mac/Linux) and typing the following command:
java -version
javac -version
The output should display the version number of Java and javac, indicating that JDK is installed
properly.
Setting Up the Environment:
After installing JDK, the next step is to set up the environment. This involves setting the PATH and
JAVA_HOME variables.
Windows:
1. Right-click on "Computer" or "This PC" and select "Properties."
2. Click on "Advanced system settings" and then click on the "Environment Variables" button.
3. Under "User variables," click on "New" and add a variable named JAVA_HOME with the value
set to the installation path of JDK (e.g., C:\Program Files\Java\jdk-15.0.2).
4. Under "System variables," scroll down and find the PATH variable. Select it and click on
"Edit."
5. Add the following value in the "Variable value" field: %JAVA_HOME%\bin;
6. Click on "OK" to close all windows and save the changes.
Mac/Linux:
1. Open a terminal and open the .bash_profile or .zshrc file using a text editor (e.g., nano
~/.bash_profile).
2. Add the following lines to the file:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
Replace jdk-15.0.2 with the version number of JDK installed on your system.