Navigation Menu

Currently the navigation bar is not functioning. Use the Blog Archive or the Google Custom Search to find content.

Saturday 1 June 2013

Setting path for running Java programs

The path is an environment variable in operating system like MS Windows,Linux. This variable can be set to values as per users convenience. The path environment variable is usually set so that it enables to compile and run Java program directly from any directory without having to set the path again and again.

Steps to set path :

Method 1 : 
Click on start menu
Click on Run (Alternatively you can press Win+R keys)
Type cmd in the run window and press Enter key
In order to compile Java program you need to set path
set path=[drive:]\Program Files\Java\jdkx.x.x_x\bin;
where x.x.x_x is the version
Note : The above method requires you to set the variable for every new instance of command prompt window opened.

Method 2 : 
Right click on My Computer icon on Desktop
Click on Properties
Select the Advanced tab from the System Properties window
(Alternatively you can press Win+Pause/Break keys)
Click on the button named Environment Variables
In the Environment Variables window find variable named PATH under 
System variables and select it
Either double click the selection or click on Edit option below
In the field named Variable value put a semicolon (;) 
at the end of line (to go to end of line press the END key).
Copy paste the whole path to the bin directory in java
[drive:]\Program Files\Java\jdkx.x.x_x\bin
where x.x.x_x is the version
Click Ok in Edit Environment Variable window
Click Ok in Environment Variables window
Click Ok in System Properties window.
Note : If you feel something is wrong or missing leave a comment below. Please report about broken links.

No comments:

Post a Comment