The article says that you will execute the java jar from within a cgi script. You need to make sure that this script is set up to execute your jar file by making the correct calls to the java executable with your hello.jar file as the parameter. Also make sure your web server is configured correctly to allow the execution of cgi scripts.
Passing the CGI environment into the Java program Writing a CGI program in Java is fairly easy to do once you understand the issues. First and foremost, you need to wrap the execution of the Java program inside another script.
A program executes and its output is sent to the browser that called the script. Normal output sent to stdout is what gets sent to the browser. The whole point of CGI scripting, however, is to create dynamic content -- each time the script executes, the output should be different.A CGI script can be written in any language that can read STDIN, write to STDOUT, and read environment variables, i.e. virtually any programming language, including C, Perl, or even shell scripting. Structure of a CGI Script. Here's the typical sequence of steps for a CGI script: Read the user's form input. Do what you want with the data.Now let's modify hello.pl so it will run as a CGI script. Every CGI script needs to output a special header as the first thing the script outputs. This header line is checked by the Web server, then passed on to the remote user invoking the script in order to tell that user's browser what type of file to expect.
This example shows how to write a midlet which can invoke CGI scripts.
Many of these HTML forms use the HTTP POST METHOD to send data to the server. Thus writing to a URL is often called posting to a URL. The server recognizes the POST request and reads the data sent from the client. For a Java program to interact with a server-side process it simply must be able to write to a URL, thus providing data to the server.
The Common Gateway Interface, or CGI, is a set of standards that define how information is exchanged between the web server and a custom script. The CGI specs are currently maintained by the NCSA. What is CGI? The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP.
In computing, Common Gateway Interface (CGI) is an interface specification for web servers to execute programs like console applications (also called command-line interface programs) running on a server that generates web pages dynamically.Such programs are known as CGI scripts or simply as CGIs.The specifics of how the script is executed by the server are determined by the server.
Sometimes you need to access other computing resources: to read or write files, list directories, or run models on the server. One way to do this is to create a Java-CGI hybrid application -- a Java applet or application that can run select CGI routines to interface with the server services.
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.
Installing your own search script. If your site supports server side functionality such as CGI, PHP, or ASP, you have the option of installing a script to handle the search function for you, on the house. As you look over the below scripts, pay close attention to the efficiency factor, for your server's sake.
The CGI (Common Gateway Interface) defines a way for a web server to interact with external content-generating programs, which are often referred to as CGI programs or CGI scripts. It is a simple way to put dynamic content on your web site, using whatever programming language you're most familiar with.
Get an output stream from the connection. This output stream is connected to the standard input stream of the cgi-bin script on the server. Write to the output stream. Close the output stream. Hassan Schroeder, a member of the Java team, wrote a small cgi-bin script, named backwards, and made it available at our Web site, java.sun.com. You can.