aspose file tools*
The moose likes Servlets and the fly likes How to run a servlet without netbeans or eclipse. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to run a servlet without netbeans or eclipse." Watch "How to run a servlet without netbeans or eclipse." New topic
Author

How to run a servlet without netbeans or eclipse.

abhinav rajput
Greenhorn

Joined: Feb 23, 2012
Posts: 4
Can anyone tell me if there is a way to compile and run a servlet without using any IDE.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

Yes, of course.

See the Servlet Specification for the structure of a web application, or find a modern tutorial.

Then use a servlet container (Tomcat is popular) to run the web app.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Well, it is simple, just specify the servlet-api.jar in the classpath when compiling your code. Package the compiled classes into a WAR file using jar command, then copy it to the webapps directory in Tomcat.


PM Me If You Want to get Urgent Help on Java Programming
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125
You can run servlet with out any IDE...

It becomes COMPLEX,
to develop a huge module consisting of larger number of files, different package structure... etc

so its better to use any of the IDE's,

You can refer the below link regarding IDE,

http://en.wikipedia.org/wiki/Integrated_development_environment
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

You don't need an IDE for any form of development. You can just code all JSPs and servlets in a text editor (preferably with syntax highlighting, granted), and test in your own (local or not) web container (e.g. Tomcat). You'll just have to redeploy the entire application if you modify the web.xml file or any of the servlets.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
While I don't particularly care what developers use to work on projects (IDE or not), I generally insist on a way to build and deploy the app without an IDE; Ant is my tool of choice for that, which also makes it easier to hook the build into Hudson/Jenkins.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

"Running a servlet" without an IDE is not a problem. "Running a servlet" without a webapp container, however, is!

Technically, you don't "run" a servlet. A servlet is not a program nor is it a process. It is a container for a method or methods that, when passed an URL request will process it and return the results. That's why you have to have something that at least minimally pretends to be a servlet container (appserver).

There are a number of options to do that. Just do a websearch for "servlet test framework".


Customer surveys are for companies who didn't pay proper attention to begin with.
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125
Rob Spoor wrote:Nonsense. You don't need an IDE for any form of development. You can just code all JSPs and servlets in a text editor (preferably with syntax highlighting, granted), and test in your own (local or not) web container (e.g. Tomcat). You'll just have to redeploy the entire application if you modify the web.xml file or any of the servlets.


Rob Spoor, Follow the Forum etiquette while provide your comments !!



Its cumbersome work, handling it using the text editor..

Let say, If your project contains 60 JSP files, 30 Servlet files handling 10 different modules.... in this case, it would be better if you work with an IDE


It's not mandatory that you should use IDE, It makes the developer effort minimal and increase the productivity.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Guru Vijay wrote:Rob Spoor, Follow the Forum etiquette while provide your comments !!

If you're talking about BeNice, I apologize. I never meant to belittle you, or not be nice to you. I misread your post; I thought you said an IDE was necessary. That was what I was calling nonsense, not the fact that an IDE makes life easier for you (which it certainly can do).
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Guru Vijay wrote:
It's not mandatory that you should use IDE, It makes the developer effort minimal and increase the productivity.


No always true, alas. Like Rob, I also always make my projects capable of being built outside an IDE. For one thing, my production build machines often are non-GUI server systems. For another, I've seen seriously reduced productivity in shops where IDEs were such integral parts of the development system that you couldn't borrow - or fix - anyone else's code unless you first re-created their entire IDE environment. Assuming it didn't conflict with your own IDE environment. Or in some cases, use an entirely different brand of IDE. That's not even considering the horrors which can result when people who don't understand technology let their IDE do their thinking for them.

Offline build systems don't have to carry this liability. Theoretically, neither should IDEs, but I'm talking what is and not what should be. My Maven-based projects can be built not only in the building, but will build equally well in Kamachatka, Karnata, or Senegal and they don't need a specific OS or IDE to do so.

Rob wasn't saying "Nonsense" to be impolite, he was saying that it literally does not make sense to get tied up that closely with the Tool of the Day.

In any event, abhinav is asking specifically how to do a non-IDE test. So that's what we're trying to help.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Tim Holloway wrote:

No always true, alas. Like Rob, I also always make my projects capable of being built outside an IDE. For one thing, my production build machines often are non-GUI server systems.


I strongly agree with that. I think in general, we should be flexible for any circumstances may happen. It's trivial to use an IDE in the workplace, however it's quite different on the customer's site where the server is installed with only Tomcat/JBoss or some else servers, and access to the server is very strict (connect only through terminal), so developers need to have ability to troubleshoot/solve problems without using IDE.

The story is different on the production environment...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run a servlet without netbeans or eclipse.