# Compiling and running Jif programs

Jif programs can be compiled through the use of the script `jifc`, which was created in the $JIF/bin directory during installation (see the README). Information on the usage of `jifc` can be obtained by executing `jifc --help`:

    $ $JIF/bin/jifc --help
    usage: jifc [options] <source-file>.jif ...
    where [options] includes:
      @<file>                  read options from <file>
      -d <directory>           output directory
      -assert                  recognize the assert keyword
      -sourcepath <path>       source path
      -bootclasspath <path>    path for bootstrap class files
      -ext <extension>         use language extension
      -extclass <ext-class>    use language extension
      -commandlineonly         only compile files named on the command-line (may
                               also require -c)
      -preferclassfiles        prefer class files to source files even if the
                               source is newer
      -fqcn                    use fully-qualified class names
      -sx <ext>                set source extension
      -ox <ext>                set output extension
      -errors <num>            set the maximum number of errors
      -w <num>                 set the maximum width of the .java output files
      -dump <pass>             dump the ast after pass <pass>
      -print <pass>            pretty-print the ast after pass <pass>
      -disable <pass>          disable pass <pass>
      -noserial                disable class serialization
      -nooutput                delete output files after compilation
      -c                       compile only to .java
      -outputamb               allow generating code from ambiguous nodes
      -post <compiler>         run javac-like compiler after translation
      -v -verbose              print verbose debugging information
      -report <topic>=<level>  print verbose debugging information about topic
                               at specified verbosity
            Allowed topics: imports, jl, labelEnv, serialize, types, frontend,
            time, resolver, cfg, visit, labels, error, dataflow, solver, jif,
            debug, errors, context, loader, verbose, qq
      -version                 print version info
      -h                       print this message
      -e -explain              provide more detailed explanations of failed
                               label checking.
      -robust                  enable checking of robustness conditions for
                               downgrading
      -debug <n>               set debug level to n. Prints more information
                               about labels.
      -stop_constraint <n>     halt when the nth constraint is added
      -globalsolve             infer label variables globally (default: per
                               class)
      -sigcp <path>            path for Jif signatures (e.g. for
                               java.lang.Object)
      -addsigcp <path>         additional path for Jif signatures; prepended to
                               sigcp
      -rtcp <path>             path for Jif runtime classes
      -addrtcp <path>          additional path for Jif runtime classes;
                               prepended to rtcp

The script `jifc` sets a number of the class path options by default. In particular:

- the class path for signatures (the `-sigcp` flag) is set to `$JIF/sig-classes:$JIF/lib/jifsig.jar`
- the class path for the runtime classes (the `-rtcp` flag) is set to `$JIF/rt-classes:$JIF/lib/jifrt.jar`
- the class path (the `-classpath` flag) is extended to include `$JIF/lib-classes` and `$JIF/lib/jiflib.jar`

where $JIF is the installation directory of this distribution.

## Running jif programs

Jif programs can be run through the use of the script `jif`, which was created in the $JIF/bin directory during installation (see the README).

The script `jif` automatically extends the classpath to include `$JIF/rt-classes`, `$JIF/lib/jifrt.jar`, `$JIF/lib-classes` and `$JIF/lib/jiflib.jar`. You will probably need to extend the classpath so that your compiled Jif classes will be found.