CL to Java - Part 2
Saturday, July 3, 2004
A couple of days ago, I
posted about different approaches to working with a mixture of CL
and Java code. In that posting, I mentioned
Rich Hickey's posting about jfli, an approach that embeds a JVM
instance in a Lisp process using JNI with LispWorks' FLI. Now,
in the same thread, Jeff Caldwell has announced that he has done
a "proof of concept" of the same approach. He stresses that his work
is just a POC and will not be taken any further; however, he wanted
to prove to himself that it could be done.
I downloaded Jeff's code and (after fixing up a couple of path
issues that were a result of my having multiple Java installs) ran it. The code brings up a Java dialog box containing some
information that was passed from CL and some information from the
Java program. When you close it, the Java code calls out to CL to
display a CAPI window with some text from the Java code. Neat!
Here is what Jeff says about his code:
"On 2004/06/23 Rich Hickey announced the pending release of jfli, a comprehensive Lisp-y interface to the Java Native Interface (JNI). His announcement generated a lot of interest. Rich estimated jfli will be in beta in a month.
I need to commit to a direction before then, so I wrote a minimal test bed to prove to myself that I can meet my promises even if jfli is delayed for any reason. This testbed is not a substitute for jfli in any manner. I look forward eagerly to jfli's release.
If anyone is interested in a 'sneak peek' at Java-Lisp integration, you may download the code at:
http://199.234.154.207/jni-lisp.html
The code demonstrates:
- embedding a Java VM in Lisp
- invoking Java from Lisp
- passing a Lisp string to Java
- passing a Java string to a Lisp callback"

