• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is tomcat compulsary

 
shabbir ali
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,
I have installed the j2ee application server.i don't have tomcat .
when i am compiling a servlet it is saying " package javax.servlet.* " not found.where is that package in the j2ee installation directory.
and is it compulsary to have tomcat to run servlets and jsp . can't i just run
with the j2ee server.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have any J2EE server for that....but if you are going for only servlets and jsp as part of learning curve ..why dont you opt for Tomcat..

Regarding javax. error,it is because the servlet api jar of your j2ee server is not in the classpath
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One quite easy way to set up Tomcat and run your code is to install Netbeans. It comes with its own Tomcat pre-configured and you can launch your applications to it directly from the IDE. Either way you are going to make life hard for yourself if you don't run Tomcat.
 
shabbir ali
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok,you are saying that we can run the servlets and jsp without tomcat.
Then Where is the file " servlet-api.jar " in the j2ee server.
I have installed j2ee 5 but unable to find Servlet.jar file .
can you tell me where is that file.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A J2EE server doesn't need to have "servlet-api.jar" specifically. It's more likely to have a j2ee.jar file that contains all APIs. Or it may bundle the jar files in totally different ways. Have you examined all the jar files that make up your J2EE server?
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat is the reference implementation of the JSP/Servlet API, it is how it is supposed to work, it is free and it is recommended by every text on the SCWCD exam, why not use it?
 
shabbir ali
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply,

Ok,I have added the " /sun/appserver/lib/j2ee.jar " file to the classpath.
but still when i am compiling the servlets it is saying
" package javax.servlet.* " not found.what i have to do.

I can use the tomcat server.Once i want to run it in the j2ee server.

please help me ........
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said before, the javax.servlet.* packages may not be in j2ee.jar. Have you examined that file to make sure that they're in there? No sense adding it to the classpath otherwise.
 
shabbir ali
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have tried all the .jar files which are /lib directory. But all are giving the same error.

then how to compile servlets without tomcat.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic