wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Run Servlet In Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Run Servlet In Eclipse" Watch "Run Servlet In Eclipse" New topic
Author

Run Servlet In Eclipse

Akmal Zahdi
Greenhorn

Joined: Apr 09, 2005
Posts: 13
Hiii....I'm just finish study all tutorial in CodeBarn in this site. At the moment now I want to concentrate on Servlet and JSP. I'm using Eclipse as a tool in writing my code. I'm using this IDE because at my office, java expert using this IDE to do a project.

My question is, anybody know how to Run Servlet in Eclipse. Any body here is expert in Eclipse. Can u explain me step by step to Run the program or u could give me link that teach this thing to me. That's all from me. Tq.


Akmal
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Hi Akmal,

I am going to move this thread to the IDE forum. A Copy will remain in this forum, but will be in a closed state, but anyone can click the link to get to the thread that will be in the IDE forum.

Good Luck

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Well here is the thing. A Servlet, the way it is supposed to be run, needs to run in a Web Server. Which basically means, no to your question.

However, there are other things you can do to "test" your Servlet running through Eclipse.

1. Remote Debugging, have the Servlet run in the Web Server, but have Eclipse hook into the Web Server for Remote Debugging. You can do a search on the JavaRanch Newsletter for remote debugging and find an article on how to set that up.

2. Mock Objects/Unit Tests. Using Mock Objects you can simulate a Web Container and pass fake Request and Response object to see how your Servlet runs.

I suggest both.

Good Luck

Mark
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

Actually, if you install the sysdeo Tomcat plugin, Eclipse will start an embedded copy of Tomcat to debug your servlet with. Just set breakpoints, do inspections, etc. just like normal.

The alternative is to deploy to an external servlet container (Tomcat, JBoss, WebWhoever, etc) that has been started with Remote Debugging enabled.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tugdual Grall
Greenhorn

Joined: Jun 14, 2005
Posts: 3
You can also use the Lomboz plugin ( http://lomboz.objectweb.org/overview.html )

And here an example using OC4J as container:
How To Use Eclipse with Oracle Containers for J2EE (OC4J)

Regards
Tug
Akmal Zahdi
Greenhorn

Joined: Apr 09, 2005
Posts: 13
Well thanks all esp 4 Mark Splitzer(coz for remove my topic here, sorry. dunno that have IDE thread ) , Tim Holloway n Tugdual Grall.

Now I can run my servlet in eclipse after asking help from my staff office. He show me step by step.

The step is :-

1) create tomcat project(I'm using eclipse SDK 3.0.1)

click File at menu bar, File > New > Project > choose Tomcat Project, click Next > give project name, click Next > show Tomcat Project Setting(URL address show on your browser), just click Finish.

2) A tomcat project created show a few files like WEB-INF/src, work, WEB-INF
and some sources TOMCAT. servlet files located in WEB-INF/src.

3) create servlet file in WEB-INF/src file

open folder project that created at 1 step, in that folder you can see 2 folders and 4 files. The folder is WEB-INF and work. click WEB-INF to open it.

4) Create XML Document as a path of servlet into the Browser.

example the document



u just need take care the Bold one, it is a path for servlet.

5) run ur server. Open ur local server home page, then extend it by the like this in ur browser.

localhost/project name/ file name

That's all from me. Tq. I'm writing this just for my refences(make this forum as my notes) and who want to starting learning servlet like me.
Akmal Zahdi
Greenhorn

Joined: Apr 09, 2005
Posts: 13
Sorry the code project is here



[edited to escape < and >]
[ June 15, 2005: Message edited by: Jeanne Boyarsky ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
136

"Akmal Java",
We're pleased to have you here with us in the IDEs forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. I'm guessing your last name isn't "Java."

Thanks,
Jeanne
IDEs Forum Bartender
[ June 17, 2005: Message edited by: Jeanne Boyarsky ]

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Not to hijack this thread, but its related -

I downloaded the WTP plugin and installed it in the Eclipse plugins.
But I can't really fine a J2EE perspective. Not sure what I am missing.

Also, I don't see a 'Tomcat project' (to choose) like mentioned in the above posts.

Any pointes please.
Thanks.

- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Run Servlet In Eclipse
 
Similar Threads
Servlet with Eclipse IDE
JSPC
where i can find JSP class files?
REST Service Using Axis2 and Hibernate
GET method working but POST method not working