A classic beginner's problem, which causes more people more trouble than almost anything else when they start.
CLASSPATH is usually set up for simple applications already. It usually contains an entry with a single . representing whichever directory the user happens to open in the shell or terminal or command prompt window. If you are using additional .jar files you may need to add their location to the CLASSPATH. CLASSPATH is where the computer looks to find the classes you are using.
PATH is usually not set up and has to be set up by the user. There are descriptions of the problems seen here in the Java tutorial; find the link to setting the PATH variable. PATH tells the computer where to look for the "java" "javac" "javadoc" etc executable files. Follow the instructions for setting the PATH to the letter. Make sure you get rid of any old Java PATHs. Ask the Bartenders to transfer this thread to beginners' where it belongs. Tell us whether you have got your application to work, and good luck with it. CR
posted 12 years ago
Thank you for the response .It worked but I have a confusion .
and the CLASSPATH: .; C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip; C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar; C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip; C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cisuz.jar; C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar; C:\PROGRA~1\IBM\SQLLIB\bin;C:\PROGRA~1\IBM\SQLLIB\java\common.jar; C:\Program Files\IBM\SQLLIB\java\jdk\bin; C:\Program Files\IBM\My Help\plugins\org.apache.ant_1.6.5\bin
and it is working when I am writing a simple .java file in any location Now my question is ...
As I understand PATH refer to the java and javac command PATH ,so they must be included in PATH user variable to avoid the repetation of fully qualified path name of those command but in my case I have not included the in the path variable but have included in CLASSPATH then why I am not getting error?Why I can run java ,javac command from any directory location? Please help me to understand the concept ..
Why do you have ant.jar in your PATH? It doesn't belong there.
The PATH environment variable is a setting for the operating system. It tells the operating system where to look for executable files, such as java.exe or javac.exe. You must put the bin directory of your JDK installation in the PATH, so that the operating system knows where to look for java.exe and javac.exe. If you can run javac without getting an error, then either the bin directory of the JDK is already in the PATH, or your current directory is the JDK bin directory.
The CLASSPATH environment variable is a setting for Java. It tells Java where to look for class files. The operating system doesn't look at CLASSPATH. It's Java-only.
Try typing the following command in a command prompt window to see what your PATH is set to:
Thanks a lot . Now its clear ..very clear I just used echo %PATH% and there is many more included in PATH and one of them is jdk/bin as well . Yes I can now match everything ..Thanks again to clear the point .
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?