Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to run Servlet program on Eclipse.?

 
Nitish Agrawal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tell me the procedure plezzz...
 
Sachin Joshi
Ranch Hand
Posts: 83
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet requires a J2EE container to run. Download and Install Tomcat server and deploy as per J2EE specification.

your application folder structure should be like this


web.xml file needs to have details of your servlet .... so you may need to read more on J2EE deployment details
 
Nitish Agrawal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what should be the location of swervlet class.?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what should be the location of swervlet class.?

Sachin's post mentions that explicitly. If that's not what you're asking, tell us in detail what it is that you are asking.
 
Nitish Agrawal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what sachin mentioned is not correct,
as i tried that but it was giving error.
The error is " NOT a Java Source Folder."
 
Nitish Agrawal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to run a servlet program on Eclipse.
Just tell me the procedure or what steps i have to follow.?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Sachin says is correct; note that the post is about running servlets in Tomcat.

Eclipse is an IDE, not a servlet container - it can't run servlets directly. It may be possible that it starts a servlet container like Tomcat internally, but even then a certain directory structure must be adhered to.

I suggest you consult the Eclipse documentation (or help) on what it does to start a servlet container (assuming it can do that), and how you can deploy servlets into that.

You might also want to look through the archive of posts on this topic. You're not the first person to wonder how to do this.
[ August 15, 2008: Message edited by: Ulf Dittmer ]
 
Sachin Joshi
Ranch Hand
Posts: 83
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing to add....If you are learning servlets then I would suggest you to run the servlet application separately in Tomcat server instead of running with the help of Eclipse of some other IDE. Because if you use these IDEs it will not be clear that how the application is deployed on server and you will not be able to understand the Servlet API specification very well.

Download a HelloWorld application from web and try to run it on Tomcat independently. This will give you clear picture how J2EE application is deployed and where different files need to be kept.

Following are things you may want to learn
- Where do we keep the jar files in a application?
- Where do we keep all class files ?
- Where are my JSP/HTML/CSS files stored?
- What is the CLASSPATH which J2EE container will look for?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic