How do I update my classpath to include a jar file?
Author: Deron Eriksson
Description: This Java tutorial shows how to update your classpath to compile and execute Java code.
Tutorial created using: Windows XP || JDK 1.6.0_10
(Continued from page 1)
The second technique that you can use is to set the classpathW variable. If you do this explicitly, then you don't need to supply a "-cp" or "-classpath" switch value to the javaSW compiler and java interpreter, since they will already know the updated classpath.
I'll set the classpath variable via the following:
(On UNIX, you wouldn't use the 'set' at the front of setting the classpath variable, and you would separate the locations with colons instead of semicolons. After this you would then "export CLASSPATH").
After setting the classpath, I can then compile and execute Howdy via:
Using technique #2, we can see the compilation and execution below: