One would have the same problem importing those classes in Java code. It's 
just not possible to import two classes with the same name, because there 
is no way to tell which one you are referring to when you use the class' 
name only (e.g. (Application.)).

However it's possible to just import one of them and then refer to the 
other one by its FQN (fully qualified name):

(ns javafx-clj.wrapper
  (:import [javafx.application Application Platform]))

; This one is javafx.application.Application
(Application.)

; and this one is javafx.clojure.Application
(javafx.clojure.Application.)

Hope it helps,

J

On Friday, December 14, 2012 10:40:28 PM UTC-3, Christian Sperandio wrote:
>
> Hi, 
>
> I'm writing a wrapper to use JavaFX with Clojure. But I hava an issue.
> I called a class javafx.clojure.Application, then in a source code I wrote:
>
> (ns javafx-clj.wrapper
>   (:import javafx.clojure.Application)
>   (:import javafx.application.Application javafx.application.Platform))
>
> ...
>
> But when I try to call a javafx.clojure.Application's function, I get that 
> exception:
>
> java.lang.IllegalStateException: Application already refers to: class 
> javafx.clojure.Application in namespace: javafx-clj.wrapper
>  at clojure.lang.Namespace.referenceClass (Namespace.java:140)
>     clojure.lang.Namespace.importClass (Namespace.java:158)
>     clojure.lang.Namespace.importClass (Namespace.java:164)
>     javafx_clj.wrapper$eval1044$loading__4784__auto____1045.invoke 
> (wrapper.clj:1)
>     javafx_clj.wrapper$eval1044.invoke (wrapper.clj:1)
>     clojure.lang.Compiler.eval (Compiler.java:6511)
>     clojure.lang.Compiler.eval (Compiler.java:6501)
>     clojure.lang.Compiler.load (Compiler.java:6952)
>     user$eval1040.invoke (NO_SOURCE_FILE:1)
>     clojure.lang.Compiler.eval (Compiler.java:6511)
>     clojure.lang.Compiler.eval (Compiler.java:6477)
>     clojure.core$eval.invoke (core.clj:2797)
>     clojure.main$repl$read_eval_print__6405.invoke (main.clj:245)
>     clojure.main$repl$fn__6410.invoke (main.clj:266)
>     clojure.main$repl.doInvoke (main.clj:266)
>     clojure.lang.RestFn.invoke (RestFn.java:1096)
>     
> clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__495.invoke 
> (interruptible_eval.clj:57)
>     clojure.lang.AFn.applyToHelper (AFn.java:159)
>     clojure.lang.AFn.applyTo (AFn.java:151)
>     clojure.core$apply.invoke (core.clj:601)
>     clojure.core$with_bindings_STAR_.doInvoke (core.clj:1771)
>     clojure.lang.RestFn.invoke (RestFn.java:425)
>     clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke 
> (interruptible_eval.clj:42)
>     
> clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__536$fn__538.invoke
>  
> (interruptible_eval.clj:170)
>     clojure.core$comp$fn__4034.invoke (core.clj:2278)
>     
> clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__529.invoke 
> (interruptible_eval.clj:137)
>     clojure.lang.AFn.run (AFn.java:24)
>     java.util.concurrent.ThreadPoolExecutor.runWorker 
> (ThreadPoolExecutor.java:1110)
>     java.util.concurrent.ThreadPoolExecutor$Worker.run 
> (ThreadPoolExecutor.java:603)
>     java.lang.Thread.run (Thread.java:722)
>
> I tried to replace the import clause by use for my 
> javafx.clojure.Application, but it doesn't work. I get the same error.
>
> Does anyone know why?
>
> Chris
>
>
>
>
>
>

-- 
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

Reply via email to