Hi Jay,
Because you�ve mentioned the use of an web server I suppose that you�re interested in running shell scripts or OS commands remotely, over the http protocol.
In theory any piece of java code that runs as a standalone application should run from within the container as well. Hence if a java program runs out of the container it should (at least in theory) run if it is "copied-and-paste" in a
servlet or
jsp; of course passing the right input parameters or setting the right environment variables etc. is mandatory, no matter whether the code is "outside or inside" of the container. Another obvious condition is that the user must have the right security privileges. Here I�m including file permissions as well. Usually the containers restrict the access to other external files, setting the
java.security.policy in the startup script like this:
Now admitting that all these conditions are satisfied then we might reduce the problem to a much simpler one: runing external commands or shell scripts from within java applications. This might also have a very simple answer because java provides you a class that can help you doing this:
java.lang.Runtime. Hence all you have to do is to write couple of pretty simple java classes that can use Runtime in order to take the command arguments and run a specified script or OS command. These are really easy to
test too. Notice that Runtime has its own limitations but for what you'd like doing it should be good enough.
Next you�d probably like to wrap those classes within a command-servlet and deploy them to your favorite web server. Finally build and deploy the command-console pages in order to allow your web browsers to run the commands remotely (using the comman servlet).
Of course this is a very insecure and basic application and I�m sure you�d never consider it more than a practice-and-learn exercise.
Regards.