[armedbear-devel] jcall jmethod java.lang

David Kirkman dkirkman at ucsd.edu
Fri Aug 20 19:13:26 UTC 2010

On Fri, Aug 20, 2010 at 11:48 AM, David Dreisigmeyer
<david.dreisigmeyer at gmail.com> wrote:
> Hi,
> I don't understand why this doesn't work:
> (jcall (jmethod "java.lang.Math" "sqrt") 4.0)

You need to give the sqrt arguments to
jmethod -- in this case "double", and a class
argument to jcall -- in this case nil

(jcall (jmethod "java.lang.Math" "sqrt" "double") nil 4.0)

For static methods you can also use jstatic:

(jstatic "sqrt" "java.lang.Math" 4.0)

-david k.

> The error I get is:
> No such method: java.lang.Math.sqrt()
> Also, this works:
> CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0)
> 4
> but when I try this:
> (jcall (jmethod "java.lang.Float" "compare") 4.0 5.0)
> I get:
> No such method: java.lang.Float.compare()
> I'm not sure if this is the correct forum for these questions.  If there's a
> better place to ask them let me know.  Thanks,
> -Dave
> _______________________________________________
> 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