Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Previously, I have set the JAVA_HOME path using the terminal with the following command:

export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386" >> ~/.bashrc

Now, I want to set the CLASSPATH environment variable to include the servlet-api.jar. Basically, what I am trying to achieve is that I should not need to type the classpath to servlet-api.jar every time I compile a Java program nor should I have to type -cp . when compiling a regular Java program whose .class file is in the same directory

I am a newbie from Windows so please a step-by-step guide would be appreciated!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The CLASSPATH variable can be extended in this way

CLASSPATH=${CLASSPATH}:/path_to_classes_dir

or

CLASSPATH=${CLASSPATH}:/path_to.jar

But I think your question is not reflecting your right intention.

servlet-api.jar is an api. It is only needed at compile time.
On run time an implementation is provided by a container like tomcat.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.