This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: imagej - a clojure example




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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]