Re: classpath for java in linux
Posted By:
Simon_Ablett
Posted On:
Monday, April 28, 2003 06:01 AM
There are several environment variables you need to set:
JAVA_HOME
Set this to point to the directory in which J2SE is installed. e.g. if J2SE is installed in '/usr/apps/j2se/1.4' then you should use something like 'export JAVA_HOME='/usr/apps/j2se/1.4'.
PATH
Add the bin directory of your Java installation to the existing PATH. The command to do this, using the previous example, would normally appear akin to the following 'export PATH=/usr/apps/j2se/1.4/bin:${PATH}'
CLASSPATH
This should reference any directories containing '.class' files that you want to use it should also explicitly reference any '.jar' files. So, for example, if your program uses two jar files 'a.jar' and 'b.jar' which you keep in a directory '/home/myself/libs' plus a group of class files which can be found in '/home/myself/src/classes' then your CLASSPATH should be set to something to similiar to the fhe following 'export CLASSPATH=/home/myself/libs/a.jar:/home/myself/libs/b.jar:/home/myself/src/classes:${CLASSPATH}'.
Hope that this helps.
Regards.