Tomcat - Classpath (setenv.sh)

by
Jeremy Canfield |
Updated: January 10 2023
| Tomcat articles
Let's say you want to add a JAR file to a Tomcat application servers classpath. This can be done by creating or editting the setenv.sh file at <tomcat home>/bin/setenv.sh.
In this example, the foo.jar file will be include in the classpath.
export CLASSPATH="$CLASSPATH /opt/tomcat/bin/foo.jar"
Restart Tomcat for this change to take effect.
/opt/tomcat/bin/shutdown.sh
/opt/tomcat/bin/startup.sh
The ps command can be used to confirm that Tomcat includes foo.jar in the classpath.
ps -ef | grep -i tomcat
Did you find this article helpful?
If so, consider buying me a coffee over at