Pin It

How to set path/classpath in Java ?.

Introduction :
In this section of blog post, we will learn how to set path or classpath in Java. After downloading Java from Sun's website, next step is to install java. After successful install we have to set classpath for Java Development Kit. Generally, in order to compile and execute a java program we have to set classpath or else every time we run java program we have to provide absolute path for compilation or execution. After installation of Java on say Windows machine, we have Java's JDK .exe installed on "C:\Program Files\Java\jdk1.6.0_18\bin". Here the CLASSPATH is the environment variable whose value is a list of directories in which compiler and interpreter search for the compiled class files.

Step 1 - Start the Control Panel
Click the Windows Start button and then click Control Panel in the menu which appears. See the figure below:

Step 2 - Click on System
In the Control Panel, Click on System. See the image below :

Step 3 : As soon as System Properties window is opened, Right-Click on Advanced tab and below in the Advanced tab, Right-Click on environment variable. See image below :

Step 4 : As soon as Environment Variable window is opened, in order to set path right-click on Path in the System Variables. After selecting Path in System Variables, right-click on edit button to place your required Java JDK path. 

Step 5 : As soon as Edit System Variable window is opened, in order to set path, scroll at the last semi-colon (;) in the variable value and place jdk's bin path as "C:\Program Files\Java\jdk1.6.0_18\bin". Then right-click on OK. After installing java in your machine just go to Program files in C drive and traverse in Java folder to bin and copy that path to place here. In my case bin path was at folder structure "C:\Program Files\Java\jdk1.6.0_18\bin".

Step 6 : Right-click on OK.

Step 6 : Right-click on Apply and then Right-click on OK.

That's it you are done in successfully setting path in Java. For testing the latest set path, open command prompt and just type Java command as "java -version" and you will get details of latest installed Java version.

Please Give Us Your 1 Minute In Sharing This Post!
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
© 2012 Learn Java by Examples Template by Hubber Spot