Top | Web home | SourceForge home
SourceForge.net Logo
$Id: //guest/julian_hyde/saffron/doc/install.html#2 $
(C) Copyright 2002, Julian Hyde
Author Julian Hyde (julian.hyde@mail.com)
Created February 15th, 2002

How to build and install Saffron

1. Contents

  1. Contents
  2. Modification history
  3. Setup build environment
  4. Build
  5. Run the demo
  6. Miscellaneous
    1. Coding guidelines

2. Modification history

Date Revision Author Comment
February 15th, 2002 1 Julian Hyde Created

3. Setup build environment

These are the products I used to build saffron. Install all of the products marked 'required'. (I use /-es in paths because I am run MKS on Windows 2000, and it makes things simpler.)

In the following, the symbol ${project.location} means the root of your source tree.

Product Required? Version Comment
JDK Yes 1.1 or later (I use version 1.3.1.) Available from http://developer.java.sun.com/. I downloaded j2sdk-1_3_1_02-win.exe, and extracted to E:/jdk1.3.1_02. Set JAVA_HOME to same, and CLASS_PATH to %JAVA_HOME%/lib/dt.jar.
Ant Yes 1.4.1 or later  Available from here. I downloaded jakarta-ant-1.4.1-bin.zip and extracted to E:/jakarta-ant-1.4.1; and downloaded jakarta-ant-1.4.1-optional.jar (needed for JavaCC) to E:/jakarta-ant-1.4.1/bin/lib and renamed to optional.jar. Edit ${project.location}/build.bat. to reference your Ant install.
JavaCC (parser generator) Yes JavaCC2.1 Available from http://www.webgain.com/products/java_cc/. Install in E:/JavaCC2.1 or similar. Edit ${project.home}/build.bat. Edit ${project.home}/build.properties.
Jikes No   You don't need this, but it builds faster and produces better error messages. Available from http://oss.software.ibm.com/developerworks/opensource/jikes/. I downloaded jikes-1.15-windows.zip, and extracted jikes.exe to C:/winnt/system32. Then uncomment the relevant line of ${project.location}/build.properties:
build.compiler=jikes
Intellij IDEA (a Java IDE) No 2.5.1 A nice IDE, with good support for refactoring. You can download a 30-day evaluation copy from http://www.intellij.com/idea/. Follow the instructions in Install.txt in idea-2_5_1.zip to there.

Create a project ${project.location}/saffron/saffron.ipr. Set the compiler output path to ${project.location}/saffron/classes/. Add hsqldb.jar, javaCupClasses.zip, and xerces.zip in ${project.location}/saffron/lib/ to the class path.

4. Build

As follows:

cd ${project.location}
build

5. Run the demo

There are two tests:

  1. src/examples/sales/Test.java contains some dynamic queries;
  2. src/examples/sales/Sales2.oj contains is Java code with relational extensions.

To generate Sales2.java from Sales2.oj and compile it to Sales2.class; and to compile Test.java to Test.class:

cd ${project.location}
build compile.examples

(There is a bug in the ojavac Ant task. If you get an IOException, remove Sales2.java and try again.)

To run Test:

build run.sales.Test

(This is still work-in-progress. Lots of horrible debug output; not all statements work; and you need an ODBC datasource called empdept in order to run the JDBC flavor of the tests. Sorry! I'll fix all of this at some point.)

To run Sales2:

build run.sales.Sales2

6. Miscellaneous

6.1. Coding guidelines

Indentation 4. Tab stop 4. Use tabs, not space. 'Berkeley' bracing convention. Use braces even for single-line blocks. Declare variables as near to their first use as possible. Don't initialize variables with 'dummy' values just to shut up the compiler. No line longer than 79 characters. Javadoc comments on methods are written in the active ('Collects garbage.') not imperative ('Collect garbage.') When editing HTML documents, don't use an editor which reformats the HTML source (such as Word).

End $Id: //guest/julian_hyde/saffron/doc/install.html#2 $