A GCJ-based servlet engine for Apache Mod_GCJ

Note: this document refers to an ancient version of mod_gcj. Up-to-date build instructions can be found inside the the source distribution

Compiling the test code with Apache 2.0

Because of limitations in libgcj (see "Known Problems" section below) mod_gcj can currently only be built as a statically linked module, i.e. it has to be compiled with and baked into Apache.

Before you start you need a rather fresh versions of the gcc/g++/gcj installed. I'm using version 3.3.1 from SuSE 9.0 which works ok. If you are using a different version I'd be interested to hear about any success/failure stories.

Because the version of libtool shipped with Apache isn't particularly smart about C++ and Java files you we also rely on an up-to-date version of libtool installed on your system for compiling our code. If compilation fails for the .cpp or .java files, try installing the latest version of libtool.

  1. Get a fresh copy of Apache 2.0 and unpack it on your system

  2. Unpack the mod_gcj package into the modules subdirectory of the Apache distribution.

  3. Change to the root directory of the Apache distribution and invoke the following command:

    This is necessary to let Apache find our module. If the script does not exist in your copy of Apache you probably don't need it.

  4. Run the ./configure script with --enable-gcj and any other switches you may need. You also need to set the LDFLAGS environment variable to -lgcj so that the linker knows about libgcj. For example, if you want Apache installed in /usr/local/apache you'd use the following:

      LDFLAGS=-lgcj ./configure --prefix=/usr/local/apache --enable-gcj

  5. run "make"

  6. run "make install"

  7. Change to the directory you installed Apache in and add the following to conf/httpd.conf:

       # configure mod_gcj handler
       <Location /test>
          SetHandler gcj
          GcjClasspath file:/path-to-apache/modules/mod_gcj/
          GcjClass page.Demo

  8. Run "bin/apachectl start" to start Apache.

If everything went according to plan, a page generated by mod_gcj should appear in your browser window. You can edit and recompile page/Demo.java in the mod_gcj directory to change it. Note that you can also use any other class as handler that implements the modgcj.Handler interface.

If something went wrong during the configure or build phase it probably has to do with libtool or gcj not being there or fresh enough. If you think there's some other problem please let me know.