Go to the first, previous, next, last section, table of contents.
The easiest way to start up Kawa is to run the `kawa'
script. This finds your java interpreter, and sets up `CLASSPATH'
correctly.
If you have installed Kawa such $PREFIX/bin
is in your $PATH
,
just do:
kawa
However, `kawa' only works if you have a Unix-like environment.
To run Kawa manually, you must start a Java interpreter.
How you do this depends on the Java interpreter.
For JavaSoft's JDK, you must have the Java interpreter
in your PATH
.
You must also make sure that the kawa/repl.class
file,
the rest of the Kawa packages, and the standard Java
packages can be found by searching CLASSPATH.
See section Getting and running Java.
Then you do:
java kawa.repl
In either case, you will then get the `#|kawa:1|#' prompt, which means you are in the Kawa read-eval-print-loop. If you type a Scheme expression, Kawa will evaluate it. Kawa will then print the result (if there is a non-"void" result).
You can pass various flags to Kawa, for example:
kawa -e '(display (+ 12 4))(newline)'
or:
java kawa.repl -e '(display (+ 12 4))(newline)'
Either causes Kawa to print `16', and then exit.
At startup, Kawa executes an init file from the user's home
directory.
The init file is named .kawarc.scm
on Unix-like systems
(those for which the file separator is '/'
),
and kawarc.scm
on other systems.
This is done before the read-eval-print loop
or before the first -f
or -c
argument. (It is not run
for a -e
command, to allow you to set options to override
the defaults.)
~/.kawarc.scm
init file to be run.
~/.kawarc.scm
init file to be run.
-e (scheme-window #t)
.
You can specify multiple `-w' options, and also use `-s'.
The options `-C', `-d', `-T', `-P', and `--main' are used to compile a Scheme file; see section Compiling Scheme to a set of .class files.
If there are further command-line arguments after the options have been processed, then the first remaining argument names a file that is read and evaluated. If there is no such argument, then Kawa enters an interactive read-eval-print loop, but only if none of the `-c', `-e', `-f', `-s', `-C', or `--' options were specified.
An alternative interface runs the Java read-eval-print-loop inside a new window. This is in some ways nicer. One reason is that it provides better editing. You can also create new windows. They can either have different top-level environments or they can share environments. To try it, do:
java kawa.repl -w
Kawa normally keeps running as long as there is an active read-eval-print loop still awaiting input or there is an unfinished other computation (such as requested by a `-e' of `-f' option).
To close a read-eval-print-loop, you can type the special
literal #!eof
at top level. This is recognized as end-of-file.
Unfortunately, due to thread-related complications, just typing
an end-of-file character (normally ctrl/D until Unix), will not work.
If the read-eval-print-loop is in a new window, you can select `Close' from the `File' menu.
To exit the entire Kawa session, call the
exit
procedure (with 0 or 1 integer arguments).
Go to the first, previous, next, last section, table of contents.