Kawa Problems

I think that I followed these instructions. In particular:
Macintosh-3:Schemes norm$ ls ka*
kawa-1.11.jar
Macintosh-3:Schemes norm$ openssl md5 kawa*
MD5(kawa-1.11.jar)= eee96e13a329513a2f705ee03bacef63
Macintosh-3:Schemes norm$ echo $CLASSPATH
/Users/norm/Schemes/kawa-1.11.jar
Macintosh-3:Schemes norm$ pwd
/Users/norm/Schemes
Macintosh-3:Schemes norm$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
Macintosh-3:Schemes norm$ xattr kawa-1.11.jar
com.apple.metadata:kMDItemWhereFroms
Macintosh-3:Schemes norm$ java kawa.repl -w
At this point the bar at the top of the Mac window has “kawa.repl” at the left end but no window appears. The Activity Monitor utility shows no CPU usage. Command Q does not terminate the app. Control C in the shell, or Force Quit does. The Mac ‘Console’ utility reports no reports.

I stumbled on a very unsatisfactory way to run Kawa: in some Terminal shell, in Downloads, or whoever your browser puts downloaded things do: rm kaw*. Launch Chrome; go here. Click on link with text “ftp://ftp.gnu.org/pub/gnu/kawa/kawa-1.11.jar”. Click “save” button. Click “Show All” (bottom right). Click ‘link’ with text “kawa-1.11.jar”. Click on “Open” in new dialog box.

Just now, after typing java kawa.repl -w into the shell where I was testing, I typed it again, by mistake actually, and an repl window came up. Most recently I had used Force Quit. This is the first time that I have been able to run Kawa other than immediately after having downloaded it. Now I can run some Scheme programs, type command Q, type in shell java kawa.repl -w and get another repl window. I type control C in the shell and Kawa quits, and type java kawa.repl -w again and it starts. It even starts from a new shell, as if there remains no problems. Curious.

After about 10 successful restarts, the problem returned. It failed several consecutive times. It started working again after buying a new shell. It works about one half the time, reminiscent of a coin flip.

The following expression results in a java.lang.NullPointerException about half of the time, even start with a fresh repl each time.

(let ((sg ((fileVal "RND") "frSeed"))) (let r ((n 2500) (m 0) (s 0))
  (if (zero? n) (cons m s) (let ((w (sg))) (r (- n 1) (+ m w) (+ s (* w w)))))))
fileVal returns the value of the expression in the named file but the above is the only logic that uses much space. If 2500 is replaced by a larger number it fails more often. There is something very noisy in the Java environment.

Adding -Xms20m (20 MB memory) to the invocation of repl does not improve things much, if any.

This does not fail:

(let r ((n 25000)(s 0)) (if (= 0 n) s (r (- n 1) (+ s (* n n)))))
Substituting the expressions in the file into the fileVal invocations, eliminates the unusual use of scheme-report-environment but does not otherwise change these results. When the program runs it gets the right answer!

Note this!!! But I think it installed the same Java as was left over after my install of OS X 10.7. This is happy under Chrome.