From: Per Bothner <per@bothner.com>
To: David Pirotte <david@altosw.be>, kawa@sourceware.org
Subject: Re: imagej - a clojure example
Date: Thu, 24 Sep 2015 21:02:00 -0000 [thread overview]
Message-ID: <560464CA.8010008@bothner.com> (raw)
In-Reply-To: <20150924153047.3f4cb377@capac>
On 09/24/2015 11:30 AM, David Pirotte wrote:
> Heya,
>
> david@capac:~/lpdi/projects/kawa/jars 61 $ ls -ls
> total 2076
> 1944 -rw-rw-r-- 1 david alto 1986620 Sep 24 15:11 ij-1.49v.jar
> 0 lrwxrwxrwx 1 david alto 12 Sep 24 15:11 ij.jar -> ij-1.49v.jar
> 132 -rw-rw-r-- 1 david alto 132846 Sep 24 15:12 mpicbg_-1.0.1.jar
> 0 lrwxrwxrwx 1 david alto 17 Sep 24 15:13 mpicbg.jar -> mpicbg_-1.0.1.jar
>
> david@capac:~/lpdi/projects/kawa/jars 62 $ kawa
> #|kawa:1|# (import (ij IJ))
> /dev/stdin:1:9: unknown library (ij IJ)
> #|kawa:2|#
Is there an actual class ij.IJ in the classpath? Otherwise what you're doing
won't work.
Try typing ij.IJ directly at the REPL and you should see if it exists. For example:
#|kawa:5|# java.util.Map
interface java.util.Map
#|kawa:6|#
> ^^ Of course it is a stupid quizz for someone who knows java, I don't and I don't
> want to. What is the scheme procedure and/or variable, like %load-path in guile,
> that I need to set! so that kawa knows where to look for when I do
>
> (import (ij IJ)) [ if that is correct, I don't know
> [ if not please correct me
You need set the classpath before you start up the Java VM - typically
on the java command line or a CLASSPATH environment variable.
For example:
$ CLASSPATH=.:ij.jar kawa
or:
$ java -cp .:ij.jar kawa.repl
It would be possible for Kawa to use a ClassLoader that can change its
search path on the fly. I don't think we'd want to do that by default,
because we want to keep Kawa "close to the [JVM] metal". With a strong use
case we could add it as an optional feature.
> Also, How do I introspect a module? Like once yu tll me how to make these
> ij-1.49v.jar, mpicbg_-1.0.1.jar, .. known to java, how can I list the public
> interface of these modules, its classes, methods ...
Introspection is a complex feature. Kawa doesn't really have an introspection
API - you can use the Java reflection API or the model API, but these are nontrivial;
certainly more than a quick reply here. What is your specific use-case?
If you're just trying the learn what's available in a libray, the usual
method is to look at the javadoc-generated API documentation. For example
for imagej look here:
http://javadoc.imagej.net/Fiji/overview-summary.html
--
--Per Bothner
per@bothner.com http://per.bothner.com/
next prev parent reply other threads:[~2015-09-24 21:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 23:38 David Pirotte
2015-09-24 18:31 ` David Pirotte
2015-09-24 21:02 ` Per Bothner [this message]
2015-09-24 23:52 ` David Pirotte
2015-09-25 1:24 ` David Pirotte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560464CA.8010008@bothner.com \
--to=per@bothner.com \
--cc=david@altosw.be \
--cc=kawa@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).