[armedbear-devel] Calling java from lisp

Mark Evenson evenson at panix.com
Fri Apr 6 07:46:55 UTC 2012


On Apr 5, 2012, at 4:34 PM, Arnaud Bailly wrote:

> OK. I can see where my first error lies: jcall parameters are
> incorrect. Here is a corrected version:
> 
> (defun java-format (fmtstring &rest args)
>          (let* ((string-class (jclass "java.lang.String"))
>                 (array-of-objs (jclass "[Ljava.lang.Object;"))
>                 (method (jmethod string-class "format" string-class
> array-of-objs)))
>            (jcall method nil fmtstring args)))
> 
> But this does not work yet as I do not know how to convert a lisp list
> to a java array. IS there any utility function  or should I do it "by
> hand" ?
> 

JAVA:JNEW-ARRAY-FROM-LIST should be what you want.


--
"A screaming comes across the sky.  It has happened before, but there is nothing to compare to it now."








More information about the armedbear-devel mailing list