Java Installation

Install JDK

JDK is the basic software for compiling and running java programs. In this article, we will learn how to install JDK on your local PC.

  1. Download the latest version of JDK from the URL
  2. Start the installation by double-clicking on JDK executable file.
  3. Choose the location where you want to install Java. Generally, it is installed c:\program files\java\jdk.
  4. After the installation of Java, you can find java tools (javac, java, Javadoc, jar) in c:\program files\java\jdk\bin.
  5. To run any java program you generally use tools like java compiler(javac) and java interpreter(java).
  6. javac and java all are command-line tools and invoked from the command line from the path where your program is saved.
  7. To enable your system to find these command-line tools (javac, java, Javadoc) from anywhere you need to set these commands path to an environment variable. So the system will automatically look up these commands.

Set the environment variable

  1. Copy the path of JDK. For example, as we have told you current JDK path is c:\program files\java\jdk.
  2. Open the environment variable dialog using the one following steps...

1. Search environment variable on your windows as shown in the following figure...


2. The second way to open the environment variable. Go to the This pc =>select properties => advance system settings => environment variable as shown the following snapshots.





3. As shown in the above dialog, there are two-section user settings and system settings. If you want to update the setting for the current login user use the user settings and update the setting for all users then use the system settings.

4. Now set the java path into the environment variable into the path variable as highlighted into the above dialog box.

5. If the path variable already exists, use the edit option to update the path otherwise create a new variable which name is path and value of the path is java path(c:/program files/java/JDK) that you have copied earlier.

6. Press the ok button to complete and update settings.

Check java path is set or not properly

To check that java is already installed or java path is properly installed follow the steps below... 

  1. Open command prompt by searching cmd in the start menu or open the run box (win + R) then type cmd and press enter.
  2. Type javac and press enter. if the list of javac tools appears means java is installed and the path is set properly.
  3. If javac returns javac is not recognized as internal or external command means the java path is not set properly.

Install Java | Video Tutorial