[armedbear-devel] Using Java Libraries
John Pallister
john at synchromesh.com
Mon Oct 19 16:51:33 UTC 2009
I've thrown Alessio's notes up onto the Wiki: it's a start, anyway...
http://trac.common-lisp.net/armedbear/wiki/JavaFfi
I'll tidy the page up a bit soon, but I'm a bit snowed under at the moment.
Cheers,
John :^P
On Mon, Oct 19, 2009 at 5:17 PM, nitralime <nitralime at googlemail.com> wrote:
>
>
> On Mon, Oct 19, 2009 at 3:54 PM, Alessio Stalla <alessiostalla at gmail.com>
> wrote:
>>
>> On Mon, Oct 19, 2009 at 3:34 PM, nitralime <nitralime at googlemail.com>
>> wrote:
>> > Thank you for this quick "cheet sheet".
>> >
>> > I find it very sad that there are no reasonable
>> > documentation (at least something like a jump start guide).
>> > Diving into source code maybe the last resort
>> > for experts which I don't belong anyway!
>>
>> If it's true that there's no existing official documentation for the
>> Java ffi (I'm not sure), I can write it one of these days, it
>> shouldn't take long. It will be useful to me too (I always forget the
>> syntax of jstatic, for example).
>
> It is a great idea!!
> I believe that many of us (newbies) would be grateful to you!
>
>
>>
>> In general abcl's documentation is
>> indeed quite lacking;
>
> That is true regarding the documentation of its interaction with the jvm
> runtime environment
> which is my primary focus of interest in ABCL.
>
>> the implementation is young, the work force is
>> scarce, and writing documentation is boring ;)
>
> We all know it and therefore honor voluntary efforts of developers!
>
> Regards
> Nik
>
>>
>> Cheers,
>> Alessio
>>
>> > Regards
>> > Nik
>> >
>> >
>> >
>> > On Mon, Oct 19, 2009 at 2:41 PM, Alessio Stalla
>> > <alessiostalla at gmail.com>
>> > wrote:
>> >>
>> >> On Mon, Oct 19, 2009 at 1:48 PM, nitralime <nitralime at googlemail.com>
>> >> wrote:
>> >> > Hi folks,
>> >> >
>> >> > I'm searching for a (more systematic) documentation (or tutorial)
>> >> > about how to use Java libraries from ABCL.
>> >> >
>> >> > I couldn't find anything else except the examples on
>> >> >
>> >> >
>> >> > "http://trac.common-lisp.net/armedbear/browser/trunk/abcl/examples/abcl".
>> >> >
>> >> > Is there any such tutorial (or documentation) at all?
>> >>
>> >> I'm not aware of any tutorial, however if you know the Java reflection
>> >> API you'll find that abcl's operators maps quite well to it. A quick
>> >> "cheat sheet":
>> >>
>> >> (jclass <class name>) gives you a Java class
>> >> (jmethod <java class> <method names> <&rest argument types>) gives you
>> >> a
>> >> method
>> >> (jconstructor <java class> <&rest argument types>) a constructor
>> >>
>> >> (jnew <constructor> <&rest arguments>) instantiates a new Java object
>> >> (jcall <method> <object> <&rest arguments>) calls a method
>> >>
>> >> then there's jstatic to access static fields and methods, and iirc
>> >> jfield to access fields. Oh, and jproperty-value and (setf
>> >> jproperty-value) to access "properties" following the Java Bean
>> >> convention (setXXX and getXXX). That's almost all; there is some more
>> >> advanced stuff (e.g. manipulating Java arrays).
>> >>
>> >> You can find most or all of this stuff inside Java.java
>> >>
>> >>
>> >> (http://trac.common-lisp.net/armedbear/browser/trunk/abcl/src/org/armedbear/lisp/Java.java).
>> >> It's not documented but quite readable.
>> >>
>> >> Also, there's an "invoke.lisp" somewhere on the net which simplifies
>> >> the Java API (at the cost of some more runtime reflection). IIRC it
>> >> depends on a non-abcl Java class. I also wrote my own ad-hoc
>> >> NIH-syndrome-influenced Java simplification layer which is less
>> >> powerful but does not depend on external stuff.
>> >>
>> >> hth,
>> >> Alessio
More information about the armedbear-devel
mailing list