Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

How to Set Path in Java - Javatpoint https://www.javatpoint.

com/how-to-set-path-in-java

Home Java Programs OOPs String Exception Multithreading Collections JavaFX JSP

⇧ SCROLL TO TOP

1 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

How to set path in Java


The path is required to be set for using tools such as javac, java, etc.

If you are saving the Java source file inside the JDK/bin directory, the path is not required to be set because all the tools will be
available in the current directory.

However, if you have your Java file outside the JDK/bin folder, it is necessary to set the path of JDK.

There are two ways to set the path in Java:

1. Temporary

2. Permanent

1) How to set the Temporary Path of JDK in Windows


To set the temporary path of JDK, you need to follow the following steps:

◦ Open the command prompt


◦ Copy the path of the JDK/bin directory
◦ Write in command prompt: set path=copied_path

For Example:

set path=C:\Program Files\Java\jdk1.6.0_23\bin

Let's see it in the figure given below:

⇧ SCROLL TO TOP

2 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

2) How to set Permanent Path of JDK in Windows


For setting the permanent path of JDK, you need to follow these steps:

◦ Go to MyComputer properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable
name -> write path of bin folder in variable value -> ok -> ok -> ok

For Example:

1) Go to MyComputer properties

⇧ SCROLL TO TOP

3 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

2) Click on the advanced tab

3) Click on environment variables

⇧ SCROLL TO TOP

4 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

4) Click on the new tab of user variables

5) Write the path in the variable name

⇧ SCROLL TO TOP

5 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

6) Copy the path of bin folder

7) Paste path of bin folder in the variable value

⇧ SCROLL TO TOP

6 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

8) Click on ok button

9) Click on ok button

⇧ SCROLL TO TOP

7 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

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).

How to set path of Java on Windows

You may also like:

How to set classpath in Java

← Prev
⇧ SCROLL TO TOP Next →

8 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

Youtube For Videos Join Our Youtube Channel: Join Now

Feedback

◦ Send your Feedback to feedback@javatpoint.com

Help Others, Please Share

⇧ SCROLL TO TOP

9 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

Learn Latest Tutorials

Splunk tutorial SPSS tutorial Swagger tutorial T-SQL tutorial Tumblr tutorial React tutorial
Splunk SPSS Swagger Transact-SQL Tumblr ReactJS

Regex tutorial Reinforcement R Programming RxJS tutorial React Native Python Design
Regex learning tutorial tutorial RxJS tutorial Patterns
Reinforcement R Programming React Native Python Design
Learning Patterns

Python Pillow Python Turtle Keras tutorial


tutorial tutorial Keras
Python Pillow Python Turtle

Preparation

Aptitude Logical Verbal Ability Interview Company


Aptitude Reasoning Verbal Ability Questions Interview
Reasoning Interview Questions Questions
Company Questions

Trending Technologies

Artificial AWS Tutorial Selenium tutorial Cloud Computing Hadoop tutorial ReactJS Tutorial
Intelligence AWS Selenium tutorial Hadoop ReactJS
Tutorial Cloud Computing
Artificial
Intelligence

Data Science Angular 7 Tutorial Blockchain Git Tutorial Machine Learning DevOps Tutorial
Tutorial Angular 7 Tutorial Git Tutorial DevOps
Data Science Blockchain Machine Learning

⇧ SCROLL TO TOP

10 sur 11 27/06/2022, 19:45


How to Set Path in Java - Javatpoint https://www.javatpoint.com/how-to-set-path-in-java

Sponsored

Foods to eat to reduce your blood


pressure
Santé Nature Innovation
Recommended by

B.Tech / MCA

DBMS tutorial Data Structures DAA tutorial Operating System Computer Compiler Design
DBMS tutorial DAA tutorial Network tutorial tutorial
Data Structures Operating System Computer Network Compiler Design

Computer Discrete Ethical Hacking Computer Software html tutorial


Organization and Mathematics Tutorial Graphics Tutorial Engineering Web Technology
Architecture Tutorial Ethical Hacking Computer Graphics Tutorial
Computer Discrete Software
Organization Mathematics Engineering

Cyber Security Automata Tutorial C Language C++ tutorial Java tutorial .Net Framework
tutorial Automata tutorial C++ Java tutorial
Cyber Security C Programming .Net

Python tutorial List of Programs Control Systems Data Mining Data Warehouse
Python Programs tutorial Tutorial Tutorial
Control System Data Mining Data Warehouse

Online Jobs from Togo. Salaries May Surprise You


Work From Home | Search ads
Sponsored

⇧ SCROLL TO TOP

11 sur 11 27/06/2022, 19:45

You might also like