As a generality, a compilation should set up all required environment
setting with each build run. Those settings should be transitory, i.e.,
should not persists beyond that build. So in your case you would add
servlet.jar to the classpath temporarily, compile, and revert the
classpath (which may happen automatically depending on how you do your
build).
If you are using an IDE, it will almost certainly handle this for you
via some sort of classpath setup screen. An IDE wouldn't be worth much
if it didn't at least handle this for you :)
If you are working from a plain command line, you have some choices...
First, write a batch file or shell script, depending on your
environment, to do your compile. This script would include setting the
classpath, your javac command, and possibly restoring the classpath to
what it was before. Note that if on Windows you execute a batch file,
the change to classpath is only valid for the life of that command line
invocation, so there's no need to "restore" anything (unless you are
going to sit at a command prompt in the same window and build a couple
of times).
Second, use Ant or Maven or some other build tool. I suggest this
option if you aren't using an IDE for sure.
It sounds like you might be doing some sort of teaching based on the
fact that it's a "getting started" project... If your going to be
teaching anyway, or if you are just learning yourself, I suggest taking
the dive into Ant right away. I like Ant myself, some prefer Maven...
the choice is yours, but I think it's fair to say that Ant is a little
more popular at this point... Maven might be king a few months down the
road though. In any case, neither is difficult at all once you get the
basics down, and it will save you a lot of trouble in the long-run.
Frank
Fred Cook wrote:
Hi All,
We our new to Tomcat and have a bit of an odd problem. We are
developing a "getting started project". We have found that we must
compile with servlet.jar in our CLASSPATH, but Tomcat will not run with
servlet.jar in the CLASSPATH. Tomcat will run with servlet-api.jar, but
the test program will not compile with servlet-api.jar in the
CLASSPATH. To be more specific we get a:
package javax.servlet.http does not exist
error when compiling against servlet-api.jar
Similar errors ocure when running Tomcat with servlet.jar
Changing the CLASSPATH everytime we decide to compile or run isn't much
fun. Anybody got an idea on why this is happening, and what the
solution is.
Tomcat vs 5.5.7
apache vs 2.0.53
RH 8.0
JDK 1.5
-Fred
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]