This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to run a servlet without netbeans or eclipse.

 
abhinav rajput
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vicky Vijay
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Moores
Bartender
Posts: 2733
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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".
 
Vicky Vijay
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic