How do I set CLASSPATH variable for Tomcat in 12.10?

7,531

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:
7,531

Related videos on Youtube

An SO User
Author by

An SO User

Updated on September 18, 2022

Comments

  • An SO User
    An SO User over 1 year

    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!