From: Peter Graves <peter@ar...> - 2007-09-18 18:08:48
On Mon, 17 Sep 2007 at 23:51:45 +0300, Ville Voutilainen wrote:
> Hi all,
> this may well be a very silly question, but after I compile a lisp file, I
> get a package named foo.abcl, which contains
> class files (bytecode) as a result of the compilation. Is there some way to
> load said bytecode files from java,
> programmatically? Or run them with the jvm? I'd like to be able to write
> stuff in lisp with abcl, and then invoke
> the lisp functions from Java code. I do know that abcl provides facilities
> for invoking java code from lisp code,
> but I'd like to be able to do the reverse, _without_ having to compile every
(defun bar () (format t "Hello from foo.lisp!~%"))
public class hello
public static void main(String args)
Interpreter interpreter = Interpreter.createInstance();
catch (Throwable t)
peter@...:~ $ abcl
Armed Bear Common Lisp 0.0.10.7 (built Mon Sep 17 11:15:27 PDT 2007)
Java 1.5.0_11 Sun Microsystems Inc.
Java HotSpot(TM) Server VM
Low-level initialization completed in 1.115 seconds.
Startup completed in 3.018 seconds.
Type ":help" for a list of available commands.
CL-USER(1): :cf foo
; Compiling /home/peter/foo.lisp ...
; (DEFUN BAR ...)
; Wrote /home/peter/foo.abcl (0.117 seconds)
peter@...:~ $ CLASSPATH=/home/peter/j/src javac hello.java
peter@...:~ $ CLASSPATH=.:/home/peter/j/src java hello
Hello from foo.lisp!
Of course, your CLASSPATH may vary.