There are two main problems in running a Java program from a web server:
You need to run the Java run-time interpreter and provide the initial class (program to run) on the command-line. With an HTML form, there is no provision for sending a command-line to the web server.
Every environment variable that will be needed by the Java program
must be explicitly passed in.
There is no method similar to the C
To deal with these obstacles, I wrote a shell CGI program that provides the information needed by the Java interpreter.
This shell script manages the interaction between the HTTP daemon and the Java CGI program that you wish to use. It extracts the name of the program that you want to run from the server-provided data. It collects all of the environment data into a temporary file. Then, it runs the Java run-time interpreter with the name of the file of environment information and the program name added to the command-line.
java.cgi script was configured and installed in
Decide On Your Local Path Policies.
My forms that use Java CGI programs specify a form action as follows:
<form action="/cgi-bin/java.cgi/CGI_Test" method="POST">Where
/cgi-bin/is your local CGI binary directory,
java.cgiis the Java front-end that allows us to run Java programs over the web and
CGI_Testis an example of the name of the Java program to run.