SourceForge Logo

What is it?

JACOL is a framework for allowing Java and Common Lisp to interoperate. It's intended use is to enable Common Lisp to function as an extension language for Java. But, it can also be used to expose Java APIs (such as Swing and DOM) to Lisp applications.

What is required?

JACOL requires JDK 1.2 or higher and GNU CLISP . I use CLISP 2.28; other versions may work but are untested. JACOL is intended for *NIX environments -- so far I have only tested it under Redhat 7.x.

How does it work?

There are several ways a framework like this could have been implemented. Perhaps the most obvious would be to use JNI and foreign-function calls. However this would require a layer of C-language glue; in order for Lisp to call a Java method it would be necessary to wrap the method with a C function. This would require a pre-compile step to parse Java source code and build C wrappers for each method.

CORBA is another possibility. However, CORBA is a heavyweight solution and inevitably ties applications to specific ORBs. Furthermore, CORBA would be "intrusive" - it would require changes to existing Java apps before they could be called from Lisp.

Another alternative would be to generate Java bytecodes directly from Lisp, similar to what Jython does with Python. This is probably a superior alternative, and I'm considering using it for future versions of JACOL. However, this would be more difficult to implement so it's on the "back burner" until I get enough time to spend on it.

An intriguing alternative would be to use LIJOS (http://pointnclick.com/lijos/) as a basis for communication between Lisp and Java. But it would require porting LIJOS to the Lisp implementation that I'm interested in using (CLISP), and I can't tell if it has the kind of license that would allow it to be used within other open-source projects.

Thanks to the flexibility provided by Java reflection, JACOL was able to be implemented using a surprisingly simple design oriented around Java and Lisp "object servers", transparently using sockets for communication. JACOL allows existing Java applications to be manipulated through Lisp without requiring any code changes or recompilation. The socket-based approach has some additional advantages by allowing remote Java and Lisp processes to communicate, and by providing a modular foundation that can easily be used to allow other programming languages to interoperate with Java and/or Lisp.

© 2001, 2002 Jason Lowdermilk