Generated on Thu Nov 2 14:49:36 2006 for Gecode/J by doxygen 1.5.0

Compiling and installing Gecode/J

The Gecode/J library, including examples and documentation, can be built on all recent versions of Windows, Linux, and MacOS X.

Porting to other Unix flavors should be easy, if any change is necessary at all.

Prerequisites

First of all, you need an installation of Gecode in order to compile Gecode/J. In addition, the pkg-config tool must be present when compiling Gecode in order to have configuration information available for Gecode/J. Please refer to the Gecode reference documentation for compilation instructions.

In order to compile Gecode/J, you need a standard Unix toolchain including the following programs:

These are available in all standard installations of Linux. On MacOS X, you need to install the Apple developer tools, and pkg-config from a source like fink, darwinports, or the pkg-config homepage. For Windows, we require the Cygwin environment that provides all necessary tools.

In order to compile and use Gecode/J, you will need the Java SE Development Kit from Sun. We require at least version 5.0. As we are using the standard JNI API, other jvms may also work, but are untested and unsupported.

The Java source files are compiled using the ant build tool, which is available from the Ant project homepage and is included in many Linux distributions and the Mac OS X developer tools. For some distributions, e.g. Debian, you have to install an additional package ant-optional to make dependency checking work.

We currently support

Configuring the sources

Gecode/J uses GNU autoconf to acquire information about the system it is compiled on. Typically, you need to run the configure script in the toplevel directory.

To setup Gecode/J for your particular system, you may need to add one or more of the following options to configure:

You can get a list of all supported configuration options by calling configure with the --help switch.

Passing options for compilation

Additional options for compilation can be passed to the compiler from the make commandline via the variable CXXUSR. For example, to pass to gcc the additional option "-mtune=i686" the following can be used:

make CXXUSR="-mtune=i686"

Compiling in a separate directory

The Gecode/J library can be built in a separate directory. This is useful if you do not want to clutter the source tree with all the object files and libraries.

Configuring Gecode/J in a separate directory is easy. Assume that the sources can be found in directory $GSOURCEDIR, change to the directory where you want to compile Gecode/J and call

$GSOURCEDIR/configure [options]

This will generate all necessary files in the new build directory.

Compiling the sources

After successful configuration, simply invoking

make

in the toplevel Gecode/J directory will compile the whole library. Gecode/J consists of a C++ part (a library using the Java Native Interface JNI) and a Java part (deployed as a jar file). By default, the jar file is installed in the system's directory for Java extensions, so that you can import Gecode/J packages without setting your classpath.

Installation

After a successful compilation, you can install the Gecode/J library by invoking

make install

in the build directory.

Compiling and running the examples

The examples can be compiled using make javaexamples. You should install Gecode/J before compiling and running the examples. After compilation, the examples can be run directly from the command line. For instance, try the n-Queens example:

java examples/Queens

For more information on example scripts see Example scripts (models).

Makefile targets

The main Gecode/J Makefile supports the following useful targets: