CL+J is a JNI based interface to a Java Virtual Machine through CFFI. It targets safe, exact and complete access to Java from Common Lisp with as high integration as possible of the Java and CL respective runtime environments (especially at the condition/exception level).
CL+J uses a set of reader dispatch-macros to simplify the Java code interface. In CL+J the traditional "Hello World!" becomes:
(#_System.out.println (jstr "Hello World!"))
Printing the list of System properties to the Java standard output stream is simply:
(#_list (#_System.getProperties) #?System.out)
The current version of CL+J is 0.1 and should still be considered of "alpha" reliability.
You can download it from here: cl+j-0.1.tar.gz
|
Lisp Implementation |
Platform |
Java VM version |
Comments |
|---|---|---|---|
|
SBCL (1.0.22 or later) |
Linux/x86, MS-Windows XP (x86) |
Sun's JDK 1.6 u12, OpenJDK 1.6 |
CFFI must be patched with this: cffi_0.10.4_sbcl_strict_widening.patch |
|
ECL (8.12 or later) |
Linux/x86, MS-Windows XP (x86) |
Sun's JDK 1.6 u12 |
ECL must be patched with this: ecl_8.12.0_long_long.patch CFFI must be patched with this: cffi_0.10.4_ecl_long_long.patch |
ASDF
CFFI 0.10.4 (patched as mentioned above) which in turn requires:
Babel 0.3.0
alexandria (2008-08-02 or later)
trivial-features 0.4
Trivial-garbage 0.17
Bordeaux-Threads 0.5.1
You need to specify the location of your JRE like this:
(defvar cl-user:*jre-home* "/some/path/leading/to/your/jre")
or tell the exact location of your JVM shared library like this (would end in jvm.dll on MS-Windows):
(defvar cl-user:*jvm-path* "/some/path/to/your/libjvm.so")
You should also provide some options to be read at JVM creation time with something like this:
(defvar cl-user:*jvm-options* '("-Djava.class.path=/your/path/to/cl_j.jar:/and/maybe/some/other.jar" "-Xrs"))
Now that the context is set, you can ask ASDF to compile and load CL+J this way:
(asdf:oos 'asdf:load-op :cl+j)
You are then ready to initialize the Java VM by calling:
(cl+j:java-init)
At this point Java is fully accessible.
Proper documentation of the CL+J public interface has yet to be written. In the meantime you could have a look at the code in the demos directory.
Ensure that CL+J is thread-safe.
Complete support for Java array types.
Document the public interface of CL+J.
Make def-java-native more robust.
cl-plus-j-devel
for
developers
cl-plus-j-cvs
CVS
log feed.
cl-plus-j-announce
for
announcements.
2009-03-19: CL+J 0.1 released.