Java certification exams like SCJP test your knowledge about java classpath. Check here for an excellent resource on the topic .
System classpath
We can specify classpath in the command line or make use of a `system'
class path. The IDEs have their own way of maintaining class paths.
System class paths will be used by both the Java compiler and the JVM
in the absence of specific instructions.
Set Linux System Classpath:
CLASSPATH=/myclasses/myclasses.jar;export CLASSPATH
Windows:
set CLASSPATH=c:\myclasses\myclasses.jar
For permanent result, in Linux, put the commands in the file .bashrc in
your home directory. On Windows 2000/NT, set it from `Control Panel',
System, Environment Variables.
You can also specify .jar files full of your required classes in your classpath.
CLASSPATH=/usr/j2ee/j2ee.jar:.;export CLASSPATH
where the `.' indicates `current directory'.
From command line, if you want to add more paths to the classpath use:
Linux:javac -classpath $CLASSPATH:dir1:dir2 ...
Windows:javac -classpath %CLASSPATH%;dir1:dir2 ...
if you have spaces in your path use double quote to concatenate words.
Also check this resource
|
|