How can I add jar files to the CLASSPATH in Linux?

user1567604 picture user1567604 · Aug 1, 2012 · Viewed 22.6k times · Source

I am pretty new with this, I need to install an application (XSLTC) on a Linux machine (I am using PuTTy). I read the instructions here. I quote:

To use XSLTC, simply put xalan.jar, serializer.jar, xml-apis.jar, and xercesImpl.jar on your classpath

How do I do add jar files to the classpath?

Answer

Rajesh J Advani picture Rajesh J Advani · Aug 1, 2012

First thing to note - you're not using "Putty" to set the CLASSPATH, you're using the 'shell' that you login to, using Putty as your SSH client.

Depending on your shell, there are different ways to set your classpath -

Bash (or compatible shells

export CLASSPATH=/full/path/to/xalan.jar:/full/path/to/serializer.jar:/full/path/to/xml-apis.jar:/full/path/to/xercesImpl.jar:$CLASSPATH

C Shell (or compatible shells)

setenv CLASSPATH /full/path/to/xalan.jar:/full/path/to/serializer.jar:/full/path/to/xml-apis.jar:/full/path/to/xercesImpl.jar:$CLASSPATH