Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

how to compile servlets in JEE 5 SDK

Thread view: 
Naeem - 10 Apr 2007 12:33 GMT
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.
Tymoteusz Gedliczka - 10 Apr 2007 12:55 GMT
> 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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.