Home » Java programming language

How to set path in Java in Windows?

Setting path in java: Here, we are going to learn how to set path in java in Windows? This tutorial has step by step guide with pictures.
Submitted by Preeti Jain, on July 03, 2019

To set path in java in two ways:

  1. Temporary [Work Till PC Shutdown]
  2. Permanent [Work for always]

1) Setting temporary path

First, we will study how to set a temporary path for compiling and execution of java program?

  1. Open the command prompt
  2. We will copy the address of the JDK/Bin directory and let us suppose our JDK Address is "C:\Program Files\Java\jdk-10.0.2\bin" then copy this address.
  3. After copying address come back to command prompt screen and type a command like this,
  4. path = C:\Program Files\Java\jdk-10.0.2\bin and press enter.

2) Setting permanent path

Second, we will study how to set a temporary path for compiling and execution of java program.

1) Go to the My Computer icon and right-click on the icon and go to the properties option and click on it. Please see the below screenshot.

set path in java (1)

2) After clicking on properties option a new window will appear on the screen like this.

set path in java (2)

3) After clicking on properties option then go to the advanced system settings tab and then click on it then a new window will appear on the screen[System Properties].

set path in java (3)

4) After clicking on advanced system settings tab a new window will appear on the screen [System Properties] and then go to the Environment Variables and then click on it.

set path in java (4)

5) After clicking on Environment Variables button then a new window will appear on the screen [Environment Variables] then go to the path of user variable and click on edit option and in case if path option does not exists then we can create new variable by clicking on new button of user variable.

set path in java (5)

6) After clicking on the edit button of user variables then a new window will appear on the screen [Edit Environment variable] then go to the new button and click on it and there paste the path of JDK and click on ok button.

set path in java (6)






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.