Header Ads

How To Set Classpath in Java

Once you install java this settings are not immediate required.It is only required when you try to run java programs from other than bin folder. Without the class path settings one can run Java programs from bin folder. But after number of coding code , the bin folder looks very unorganized. Even if you have created and archived the source and .class files to another folder. To run them you need to bring them into bin folder.

It would have been great if we could create our own folder structure place required source code and .class files into them and could run.

Yes!! if you are thinking this then this post is for you. To solve this problem we need to set classpath for java.
Lets see how:

Step 1: First install java software,say in E drive or in C drive inside folder j2sdk1.4.2_01 or java

Step 2: Now,set the class path.
Step 3: Go to 'My Computer'.
Step 4: Right click on mouse and go to 'Properties'.

Step 5: Go to 'Advanced' on the 'System Properties'. then click on 'Environment Variables'

Step 6: In User Variables click 'New'.

Step 7: Write 'JAVA_HOME' in Variable name and the path where the software is installed in Variable value.And then click 'OK'.
Step 8: In System variables, click new and give the values as in figure.And then click 'OK'.
Step 9: In System variables, there will be a variable named 'Path'. Double click there. A new window will come. In 'Variable value' give a semi-colon after whatever is written. After that write '%Path%;C:\j2sdk1.4.2_01\lib;.;'  (if the software is installed in j2sdk1.4.2_01 folder of C drive.for this device it is in E:\java\lib And click 'OK' wherever required.

Hope you enjoyed this post. Please consider sharing this article .Also let me know if you face any issue regarding the same.
Powered by Blogger.