Wednesday, December 3, 2008

Java Compilation Problems (2)

Ah well, in this blog I would like to address an issue that had confronted me about 2 years ago. I really had to pull out all my hairs to resolve this problem at that time since I received no external help. But as good as your luck turns out to be, I am just glad to be able to help. Setting classpath variables is a headache for novice programmers. So i'll try to make it as simple as possible.

To execute a java program from any directory in your system, u need to do the following (this is for windows XP users only) :

1) Right click on My Computer->properties
2) Go to the Advanced tab
3) You shall see a small button named Environment variables. That's the one u need to click.
4) A dialog box will open up showing the various system variables.
5) U need to add a new environment variable in the user variable dialog box. Click on new.

Add the following:
Variable name : PATH
Variable value : the complete path to the bin folder of your java installation directory
For example, on my system, the setting is the follows:
Variable name : PATH
Variable value : C:\Program Files\Java\jdk1.5.0_12\bin

There you go. Just go and have a good time playing around with all the java files that u can, and experience the ease with which you can compile the files without setting the classpath each time or painfully copying the files to the bin folder.

Signing off
Ryan

No comments: