File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes System.exit() in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "System.exit() in servlet" Watch "System.exit() in servlet" New topic

System.exit() in servlet

Durga Krishna

Joined: Jul 10, 2006
Posts: 11
hi everybody,

Please tell me what will happen if my servlet is having System.exit();
And aslo plesase tell me how to fix the bug in my module? what is the procedure to follow?
Justin Yao

Joined: Jun 16, 2006
Posts: 19
This method will terminate the currently running JVM, so your sevlet will
be terminated.

[ July 12, 2006: Message edited by: Yao Gao ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Don't do that.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

Originally posted by Yao Gao:

so your sevlet will be terminated.

While that's technically true, that's only because the entire server will be shut down.
[ July 12, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Many production servers will run with a SecurityManager in place, in which case that operation is usually not permitted.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
that doesn't make it a good idea to use it though

subject: System.exit() in servlet
It's not a secret anymore!