Shell servlet 2.1

    It is a Java servlet lets you execute commands on your server. So you can use this tool for remote host administration (copy files, do backup, reboot etc.) Servlet supports WAP/WML, so you can do this even from your mobile phone.

How to use it:

a) copy shellPackage.jar into WEB-INF/lib directory

b) describe Shell servlet in your web.xml file:


c) describe a mapping for this servlet:


    the usage is:


Shell servlet demo

you can directly type this request, add a link to your page or insert iframe with src attribute points to this servlet.

After the opening servlet's screen just type your host command and press Enter. E.g. some like this:

ls -la for Unix based host or /c dir for Windows 2000/XP

    You can change common settings for this servlet in the configuration file. Configuration file must be provided as an initial parameter for this servlet. Parameter name is config and this parameter contains a name of text file with your settings.

So in your web.xml you can have some like this:


Configuration file is a text file describes user's settings in the form of parameter=value. Empty lines and any line starts with # or // are ignored. Current version supports the following list of parameters:
# title. Default value is Coldbeans Shell Servlet
title=My host

# prefix. Default value is empty.
# e.g. for XP-host you can set /c
# and type your commands without this part. /c

# Frames settings (how to split the screen between the command line and output window). Default value is 80%,20%

# Background color for shell's screen. Default value is #000000

# Foreground color for shell's screen. Default value is #008000

# Background color for command's screen. Default value is #D3D3D3

# Foreground color for command's screen. Default value is #000000

# Font size. By default is current browser's font.

# Font face. By default is current browser's font.

Custom interface

You may redesign HTML screens and use your own interfaces. For example you may use your own forms for posting commands to servlet. You can execute HTTP POST command to the following URL: http://your_host/servlet/ShellServlet?act=3. Parameter cmd must contain your shell command. For example, create HTML form with text input field named cmd and action points to http://your_host/servlet/ShellServlet?act=3.

For JSP integration check out also Hosts scripts tag from Coldtags suite.

    For downloading:  shellPackage.jar   
    Sample of configuration file:  shellcnf

  © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: