When do I need "struts.jar" on my classpath?

When you are compiling an application that uses the Struts classes, you must have the "struts.jar" on the
classpath your compiler sees -- it does not have to be on your CLASSPATH environment variable. Why is that an
important distinction? Because if you are using a servlet container on your development machine to test your application, the
"struts.jar" must not be on your CLASSPATH environment variable when running the ontainer. (This is because each
Web application must also have their own copy of the Struts classes, and the container will become confused if it is on the
environment path as well.) There are several general approaches to this issue:

Use ANT for building your projects -- it can easily assemble classpaths for the compiler. (This is how Struts itself
is built, along with Tomcat and most other Java-based projects).

Use an IDE where you can configure the "class path" used for compilation independent of the CLASSPATH environment
variable.

Use a shell script that temporarily adds struts.jar to the classpath just for compilation, for examplejavac -classpath /path/to/struts.jar:$CLASSPATH $@

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.