On 12 April 2010 13:21, alux <alu...@googlemail.com> wrote:
> Hello,
>
> sorry, I'm a bit slow today. I try to create an instance of a Java
> class I want to use, and am just confused.
>
> The Java code is
>
> import javax.sound.sampled.*;
>
> ...
>
> Line.Info li = new Line.Info(Object.class);
>
> My two (wrong) trials are:
>
> (def li (new javax.sound.sampled.Line/Info (.getClass (Object.))))
> ; gives Unable to resolve classname: javax.sound.sampled.Line/Info
> ; [Thrown class java.lang.IllegalArgumentException]
>
> (def li (new javax.sound.sampled.Line.Info (.getClass (Object.))))
> ; javax.sound.sampled.Line.Info
> ; [Thrown class java.lang.ClassNotFoundException]
>
> Does anybody see what I'm doing wrong here?

Inner classes are called Outer$Inner internally and by Clojure.  (As
far as I understand it.)

I think this is what you want:

user=> (import '(javax.sound.sampled Line$Info))
javax.sound.sampled.Line$Info
user=> (Line$Info. Object)
#<Info class java.lang.Object>

> Beside, ist there a way to access the Java class in a direct way, like
> the Java literal Object.class ?

Just use the name of the class directly, like Object.

-- 
Michael Wood <esiot...@gmail.com>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to