You probably want to set the path variable to include the bin folder of the JDK, and set the classpath variable to include your programs.
The path never changes (unless you want to switch between JDKs) so it's safe to set it in the system. In Windows, start / settings / control panel / system / advanced / environment variables button. Then add the full path to the bin directory to the path.
I change the classpath often depending on the program I'm running. I often have a batch file just for one program that adds the necessary jars and other projects I'm working with. For simple exercise programs, it may be enough to have "." in the classpath for current directory, so make sure the "." is in the system defined classpath.
See if this tutorial makes things clearer or worse. Follow the link at the beginning to Sun's setup pages. [ July 18, 2007: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I set the path variable to the bin directory ie D:\Program Files\Java\jdk1.6.0\bin and JAVA_HOME to the parent folder ie D:\Program Files\Java\jdk1.6.0\ I can successfully compile my program using javac but when i run it using java it always gives me some class error!! I've tested it with some basic programs such as only a single println statement but it does'nt run. But, it works fine from within the java's bin folder when the .class file is present there!