Quick Start

to the K.U.Leuven JCHR System

Before you start...

Make sure you have installed a Java Development Kit (JDK) and Java Runtime Environment (JRE) installed, both version 1.5 or higher.

In the following we will denote which Java libraries have to be included on the Java search path, and where to download them.

For those unfamiliar with these topics, some more information can be found here.

The K.U.Leuven JCHR compiler

Besides the K.U.Leuven JCHR system, following tools have to be included in the class search path when using the compiler:

Each download will include a JAR file containing the compiled tool.

To compile e.g. xxx.jchr a typical session starts with:

java compiler.Main < xxx.jchr

(hereby we assume the Java class search path is set by an environment variable, otherwise of course the classpath-option has to be used. For more information on how to set the Java search path we refer to this basic tutorial.)

This instruction will generate several Java source files to ./ud/xxx_handler/, if xxx.jchr declares a handler named xxx_handler (for the examples available on the website the handler-name is always the same as the name used in the file-name). The next step is to compile these files by your preferred Java 1.5+ compiler, e.g. again assuming the classpath has been set (only the K.U.Leuven JCHR runtime system and the current directory are required this time):

javac ud/xxx_handler/*.java

Using the generated files

These Java classes can afterwards easily be used in your Java applications. Gcd.java is a small example, using the gcd-handler (available on the website) to calculate the greatest common divider of two numbers. Try it out yourself by first compiling the gcd handler (as explained above) and then simply typing the following (in both cases the classpath has to include the K.U.Leuven JCHR Runtime System and the directory where Gcd.java is located):

javac Gcd.java

java Gcd 123 456
  ==> gcd(123, 456) == 3