|s i s t e m a o p e r a c i o n a l m a g n u x l i n u x||~/ · documentação · suporte · sobre|
There are two main problems in running a Java program from a web server:
You can't run Java programs like ordinary executables.
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.
Java does not have general access to the environment.
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.
The java.cgi script.
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.
Invoking java.cgi from an HTML form.
My forms that use Java CGI programs specify a form action as follows:
<form action="/cgi-bin/java.cgi/CGI_Test" method="POST">Where
Next Previous Contents