On Wed, 14 Mar 2001, Jesse Vitrone wrote:
> I took WEB-INF classes out of my classpath, as well as struts.jar, and
> restarted Apache and Tomcat, but I still get the same error.
>
> It's a problem if struts.jar is in my classpath?
Yes, if you have it on your classpath when you start Tomcat. See the
message archives for lots of messages about what problems this causes.
> How am I expected to
> compile?
>
Here's a couple of approaches:
* Create a simple shell script that compiles for you with a custom
class path. For example, create a "myjava.sh" script (on Unix)
that says:
javac -classpath /path/to/struts.jar:$CLASSPATH "$@"
and use this to compile things that need Struts.
* Use the Ant development tool (which is how Struts itself is built).
There is an "Application Developer's Guide" in the Tomcat documentation
that talks about how to use Ant to create web applications.
> Do I need to have my classes and properties in a package? Right now, I
> didn't put anything in a package, they're just in my classes folder.
>
The servlets will not have any problems with this, but the JSP pages
will. This happens because a JSP page is compiled into a servlet, and
different servlet containers put the generated servlet into different
packages. When you try to use <bean:define> or <jsp:useBean> with an
unpackaged class name, the servlet container will look for this class in
the same package as the generated servlet.
For portability and correct operation, you should make your bean classes
in packages.
> Thanks,
> Jesse
>
Craig McClanahan