[armedbear-devel] Using Java Libraries
Alessio Stalla
alessiostalla at gmail.com
Mon Oct 19 13:54:16 UTC 2009
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). In general abcl's documentation is
indeed quite lacking; the implementation is young, the work force is
scarce, and writing documentation is boring ;)
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
>
>
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
>
>
More information about the armedbear-devel
mailing list