<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>Java CGI HOWTO: Setting Up Your Server to Run Java CGI Programs (With Explanations)</TITLE> <LINK HREF="Java-CGI-HOWTO-3.html" REL=next> <LINK HREF="Java-CGI-HOWTO-1.html" REL=previous> <LINK HREF="Java-CGI-HOWTO.html#toc2" REL=contents> </HEAD> <BODY> <A HREF="Java-CGI-HOWTO-3.html">Next</A> <A HREF="Java-CGI-HOWTO-1.html">Previous</A> <A HREF="Java-CGI-HOWTO.html#toc2">Contents</A> <HR> <H2><A NAME="install-long"></A> <A NAME="s2">2. Setting Up Your Server to Run Java CGI Programs (With Explanations)</A></H2> <P>This section will lead you through installing my <EM>Java CGI</EM> package with copious explanations so that you know what the effects of your actions will be. If you just want to install the programs and don't care about the whys & wherefores, skip to <A HREF="Java-CGI-HOWTO-3.html#install-short">Setting Up Your Server to Run Java CGI Programs (The Short Form)</A>. <P> <P> <P> <H2><A NAME="ss2.1">2.1 System Requirements</A> </H2> <P>This software should work on any unix-like web server that has the Java Development Kit installed. I am using it on a <EM>Debian Linux</EM> system running <EM>apache</EM> as the HTTP daemon. If you find that it does not run on your server, please contact the mailing list. See <A HREF="Java-CGI-HOWTO-1.html#mailing-list">The Mailing List</A> for details. <P>Unfortunatly, the Java run-time interpreter seems to be something of a memory hog -- you may want to throw another few megabytes of RAM onto your server if you will be using Java CGI programs a lot. <P> <P> <P> <H2><A NAME="ss2.2">2.2 Java CGI Add-On Software</A> </H2> <P>The software that I wrote to aid in this is called <EM>Java CGI</EM>. You can get it from <A HREF="ftp://ftp.orbits.com/pub/software/java_cgi-0.5.tgz">ftp://ftp.orbits.com/pub/software/java_cgi-0.5.tgz</A>. (The version number may have changed.) <P> <P> <P> <H2><A NAME="ss2.3">2.3 Unpacking the Source</A> </H2> <P>Find a convenient directory to unpack this package into. (If you don't already have a standard place to put packages, I suggest that you use <CODE>/usr/local/src</CODE>.) Unpack the distribution with this command: <PRE> gzip -dc java_cgi-0.5.tgz | tar -xvf - </PRE> This will create a directory called <CODE>java_cgi-0.5</CODE>. In there you will find the files referenced in the rest of this document. (If the version number has changed, use the instructions from within that distribution from this point on.) <P> <P> <P> <H2><A NAME="make-programs"></A> <A NAME="ss2.4">2.4 Decide On Your Local Path Policies</A> </H2> <P>You need to decide where you want your Java CGI programs to live. Generally, you will want to put them in a directory in parallel with your <CODE>cgi-bin</CODE> directory. My <EM>apache</EM> server came configured to use <CODE>/var/www/cgi-bin</CODE> as the <CODE>cgi-bin</CODE> directory, so I use <CODE>/var/www/javacgi</CODE> as the directory to put Java CGI programs in. You probably do not want to put your Java CGI programs into one of the existing <CODE>CLASSPATH</CODE> directories. Edit the Makefile to reflect your system configuration. Make sure that you are logged in as the root user and run <CODE>make install</CODE>. This will compile the Java programs, modify the <CODE>java.cgi</CODE> script to fit in with your system and install the programs in the appropriate places. If you want the HTML version of this documentation and an HTML test document in addition, run <CODE>make all</CODE> instead. <P> <P> <P> <H2><A NAME="install-test"></A> <A NAME="ss2.5">2.5 Testing your installation.</A> </H2> <P>Installed from the distribution are HTML documents called <CODE>javacgitest.html</CODE>, <CODE>javaemailtest.html</CODE> and <CODE>javahtmltest.html</CODE>. If you installed <CODE>all</CODE> in the previous section, it will be in the directory you specified for WEBDIR in the <CODE>Makefile</CODE>. If you didn't, you can run <CODE>make test</CODE> to build them from <CODE>javacgitest.html-dist</CODE>, <CODE>javaemailtest.html-dist</CODE> and <CODE>javahtmltest.html-dist</CODE>. <P>When you are sure that your installation is working correctly, you may wish to remove <CODE>CGI_Test.class</CODE>, <CODE>Email_Test.class</CODE> and <CODE>HTML_Test.class</CODE> from your JAVACGI directory and <CODE>javacgitest.html</CODE>, <CODE>javaemailtest.html</CODE> and <CODE>javahtmltest.html</CODE> from your WEBDIR directory as they show the user information that is normally only available to the server. <P> <P> <P> <HR> <A HREF="Java-CGI-HOWTO-3.html">Next</A> <A HREF="Java-CGI-HOWTO-1.html">Previous</A> <A HREF="Java-CGI-HOWTO.html#toc2">Contents</A> </BODY> </HTML>