Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to set path in unix

Status
Not open for further replies.

vikind

MIS
Dec 11, 2003
58
US
hi,

i am using a java class that imports org.xml.sax.* package now when i compile
the class it gives an error cannot find the org.xml.sax handler class. the environment
is unix..i have the xerces.jar and jaxp-api.jar files under the directory where i have the
java class file. can anybody suggest me how to set the classpath on unix environment.
any exact steps that i should follow..

thanks in advance
 
on prompt:

Set CLASSPATH=/foo/bar/x.jar:/bar/foo/y.jar
export CLASSPATH

a) Upper and lowercase matters.
b) You seperate different paths with colon: not semicolon ;

To make this persistent, you may put the two lines into your home-directory into the file .bashrc
~/.bashrc
if your favourit shell is bash.
prove this by typing
echo $SHELL
in your shell.

You should specify JAVA_HOME as well:
set JAVA_HOME=/usr/lib/j2sdk
export JAVA_HOME

this should avoid specifying the std-java-libs (rt.jar, ...) in the classpath.
To prove your settings type
echo $JAVA_HOME
echo $CLASSPATH
For .bashrc to have effekt you need to logout and login again.

Since xerces and jaxp are commonly used libs, you will be better up putting them into the 'ext' directory.
/.../java/jre/lib/ext/xerces.jar

Then they should be found without CLASSPATH.
I'm develeping with linux/java and have no classpath at all.
Just JAVA_HOME.
As a second issue, I have
/opt/j2sdk-2.4.0
/opt/j2skd-2.4.2-rc
and a link,
/opt/java
pointing to one of them - so I can easily switch ...
 
stefan

thanks a lot for your help !
will try this out..
appreciate it!!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top