File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Trying to run my first servlet through Eclipse + XAMPP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Trying to run my first servlet through Eclipse + XAMPP" Watch "Trying to run my first servlet through Eclipse + XAMPP" New topic
Author

Trying to run my first servlet through Eclipse + XAMPP

Hall Nation
Greenhorn

Joined: Jun 30, 2009
Posts: 5
I'm trying to run my first servlet through eclipse, I'm using XAMPP + Tomcat add-on as my webserver. How do I even try and compile my servlet ? I've added the external jar Servlet-api.jar to my project as stated in here, http://www.theserverside.com/discussions/thread.tss?thread_id=37924
But eclipse wouldn't compile it, because there just isn't a main() in my servlet program..

Do I need to install the WPT plugin for eclipse? I'm guessing I'm not setting my CLASSPATH correctly - Do I need to set it up manually?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

When you downloaded Eclipse, did you choose the "Eclipse for Java EE Developer's" package? If not, go back and do that - that package contains WPT and various other packages helpful for building and running servlets.


JBoss In Action
Hall Nation
Greenhorn

Joined: Jun 30, 2009
Posts: 5
Well Peter,

Nevermind, there were lots of Issues going the XAMPP way, so I just installed Tomcat separately and all is fine now.

I used instructions from http://www.scribd.com/doc/495993/Installing-Apache-Tomcat-6-and-Using-It-With-Eclipse and it was just a walk-in-the-park..

EDIT :

I have one small quirk though..
Let's just say I'm trying a basic 'Dynamic Web Application' in Eclipse (I have the Java EE Developers' package installed), with a basic helloworld servlet like this : http://codepad.org/KzSB4m6z. Everytime, I need to put in the .CLASS that gets generated in the 'eclipse_workspace> proj_name > build > classes ' into 'eclipse_workspace> proj_name > WebContent' manually. Is there an automatic setting that does this ? I find that only by manually copying the .CLASS file to the location I mentioned does it work, otherwise it refuses to.
I'm using the local instance of Apache Tomcat from within Eclipse.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trying to run my first servlet through Eclipse + XAMPP
 
Similar Threads
Need help urgently: problems compiling servlets
java.io.FileNotFoundException: http://localhost:8080/MyServlets/MyServlet
javax.servlet not found
Having Classpath trouble on my new iMac
what are the steps to run my first servlet by JBoss