/ Java

How to set the path of JDK?

Before setting the path, you must need the JDK based on your devices. You can download the JDK from here.

 

How to set the path of JDK in Windows OS?

In windows, you can set the path of the Java Development Kit (JDK) in two ways.

  1. Setting Temporary Path of JDK
  2. Setting Permanent Path of JDK

 

1) How to set Temporary Path of JDK in Windows

Perform the following steps to set up the temporary path of JDK in Windows OS.

  1. Open Command Prompt

Command Prompt

  1. Copy the path of jdk/bin directory installed in your computer. Normally it is located in the C:\Program Files\Java\jdk1.8.0_91\bin

  1. Write in command prompt: set path=<copied_path>

For Example:

set path=C:\Program Files\Java\jdk1.8.0_91\bin

Now you can run your first Java Program in the Command Terminal.

 

2) How to set Permanent Path of JDK in Windows

  1. Go to start button and Click on

  1. Then the System tab will appear, Click on the Advanced System Settings.

Advanced System Settings

  1. A new popup will appear, Click on the Advanced > Environment Variables.

Step 3

 

  1. A new popup for Environment Variables will appear. Click on New.

Step 5

  1. Now go to your JDK installation directory and copy the path (Example: C:\Program Files\Java\jdk1.8.0_91\bin)

Step 4

  1. Enter the New User Variable parameter as
    1. Variable Name: path
    2. Variable Value: (Your JDK bin path)

Step 6

  1. Now Click OK-> OK-> OK

Check whether the path has been set or not by performing the following task:

  1. Open Command Prompt.

Command Prompt

  1. Type java –version

java version

  1. If you get the java version your path is set otherwise you’ll get an error.

Now your permanent path is set. You can now execute any program of java from any drive.

 

Setting Java Path in Linux OS

Setting path in Linux OS is the same as setting the path in the Windows OS. But here we use the export tool rather than set. Let’s see how to set path in Linux OS:

 

export PATH=$PATH:/home/jdk1.6.01/bin/

Here, we have installed the JDK in the home directory under Root (/home).

 

Download the article.

Write your First Program in Java.

Java Virtual Machine

Dipendra Laxmi Bahadur Chand Thakuri
CEO @ Vine Software Innovation Company (Pvt.) Ltd. (VSIC)
View More

Comments:

1 comment(s)!
Write your First Program in Java – Saral Notes
[…] Set the path of the JDK on your computer. […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

back to top button
error: Please be respectful of copyright. Unauthorized use is prohibited.
%d bloggers like this: