I have installed JEE5 with JDK on windows. When I compile a servlet
using 'javac', it gives the error that javax.servlet package does not
exist. I have tried by adding path of j2ee.jar file in classpath
environment variable (classpath variable doesn't exist, i have created
one) and even tried to copy j2ee.jar file in jdk\jre\lib\ext folder
but no results. Should i need to install JSDK or jee 5 sdk can compile
the servlets. if so how?
Please help....
Thanks.
> I have installed JEE5 with JDK on windows. When I compile a servlet
> using 'javac', it gives the error that javax.servlet package does not
[quoted text clipped - 5 lines]
> Please help....
> Thanks.
You need to add servlet-api.jar to your buildpath. If you use Tomcat
then it's located in lib subdirectory of your Tomcat installation.
I haven't used other containers, but I guess they provide this jar as
well, just look for it.
Naeem - 10 Apr 2007 13:28 GMT
On Apr 10, 4:55 pm, Tymoteusz Gedliczka <t...@student.agh.edu.pl>
wrote:
> > I have installed JEE5 with JDK on windows. When I compile a servlet
> > using 'javac', it gives the error that javax.servlet package does not
[quoted text clipped - 11 lines]
> I haven't used other containers, but I guess they provide this jar as
> well, just look for it.
I am not using Tomcat but Java APP Server. I guess this file is
j2ee.jar but how and where to copy it?
Bla - 10 Apr 2007 18:01 GMT
What's Java App Server ? Never heard of that.
jon - 10 Apr 2007 21:51 GMT
> What's Java App Server ? Never heard of that.
Probably "Sun Java System Application Server".
ruds - 11 Apr 2007 04:36 GMT
Try downloading the servlet.jar file from java.sun.com and put it in
lib folder of your sdk.
Add this path to your evironment variable CLASSPATH. And then try
compiling your servlet
Lew - 11 Apr 2007 13:14 GMT
> Try downloading the servlet.jar file from java.sun.com and put it in
> lib folder of your sdk.
> Add this path to your evironment variable CLASSPATH. And then try
> compiling your servlet
It won't work. Toncat, Sun's server and all the others of which I know ignore
the CLASSPATH envrionment variable.
Even programs that don't should have their classpath set in the invocation,
not in the environment variable.
The OP has /already/ downloaded the necessary JARs if they've correctly
installed Sun's application server.
To the OP: Read the documentation that comes with the app server. It will
explain how to deploy applications, which is the process you need. I use the
application server's admin task (installed to monitor port 4848 by default) to
deploy applications.
Read the documentation. Ignore specious advice about downloading servlet.jar
or j2ee.jar or whatever, or about CLASSPATH, and use the techniques built into
the app server.

Signature
Lew
Lew - 11 Apr 2007 13:18 GMT
> Try downloading the servlet.jar file from java.sun.com and put it in
> lib folder of your sdk.
> Add this path to your evironment variable CLASSPATH. And then try
> compiling your servlet
The OP has /already/ downloaded the necessary JARs if they've correctly
installed Sun's application server.
Also, the CLASSPATH envar is not the only way to specify class paths. It is
the least flexible method. One can use command-line options to set the class
path more flexibly.
To the OP: Read the documentation that comes with the app server. It will
explain how to build and deploy applications, which is the process you need.
I use the application server's admin task (installed to monitor port 4848 by
default) to deploy applications.
If you aren't using an IDE to build your app, use Ant.

Signature
Lew