Ignore me. I forgot to set *compile-path*. Everything works fine after that. Sorry for the noise.
On Dec 12, 9:39 pm, ntu...@googlemail.com wrote: > For the first time I tried to use gen-class (using svn r1156), but > unfortunately compilation fails: > > u...@computer /tmp $ mkdir test > u...@computer /tmp $ cd test/ > u...@computer /tmp/test $ mkdir -p clojure/examples > u...@computer /tmp/test $ gvim clojure/examples/instance.clj ;copied > the source fromhttp://clojure.org/compilationinto the editor and > saved it [1] > u...@computer /tmp/test $ mkdir classes > u...@computer /tmp/test $ java -cp > .:classes:/opt/clojure/clojure/trunk/clojure.jar clojure.main > Clojure > user=> (compile 'clojure.examples.instance) > java.lang.RuntimeException: java.lang.ClassNotFoundException: > clojure.examples.instance$_init__4 (NO_SOURCE_FILE:0) > user=> (.printStackTrace *e) > java.lang.RuntimeException: java.lang.ClassNotFoundException: > clojure.examples.instance$_init__4 (NO_SOURCE_FILE:0) > at clojure.lang.Compiler.eval(Compiler.java:4147) > at clojure.core$eval__3542.invoke(core.clj:1486) > at clojure.main$repl__5154$fn__5169.invoke(main.clj:100) > at clojure.main$repl__5154.doInvoke(main.clj:96) > at clojure.lang.RestFn.invoke(RestFn.java:426) > at clojure.main$repl_opt__5194.invoke(main.clj:153) > at clojure.main$_main__5218.doInvoke(main.clj:228) > at clojure.lang.RestFn.invoke(RestFn.java:402) > at clojure.lang.AFn.applyToHelper(AFn.java:191) > at clojure.lang.RestFn.applyTo(RestFn.java:137) > at clojure.main.main(Unknown Source) > Caused by: java.lang.RuntimeException: > java.lang.ClassNotFoundException: clojure.examples.instance$_init__4 > at clojure.lang.Compiler$FnExpr.getCompiledClass(Compiler.java:3211) > at clojure.lang.Compiler$FnExpr.emit(Compiler.java:3223) > at clojure.lang.Compiler$DefExpr.emit(Compiler.java:318) > at clojure.lang.Compiler.compile(Compiler.java:4560) > at clojure.lang.RT.compile(RT.java:362) > at clojure.lang.RT.load(RT.java:404) > at clojure.lang.RT.load(RT.java:376) > at clojure.core$load__4555$fn__4557.invoke(core.clj:3427) > at clojure.core$load__4555.doInvoke(core.clj:3426) > at clojure.lang.RestFn.invoke(RestFn.java:413) > at clojure.core$load_one__4518.invoke(core.clj:3271) > at clojure.core$compile__4561$fn__4563.invoke(core.clj:3437) > at clojure.core$compile__4561.invoke(core.clj:3436) > at user$eval__1.invoke(Unknown Source) > at clojure.lang.Compiler.eval(Compiler.java:4136) > ... 10 more > Caused by: java.lang.ClassNotFoundException: > clojure.examples.instance$_init__4 > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > at > clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:52) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at java.lang.ClassLoader.loadClass(ClassLoader.java:252) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:247) > at clojure.lang.RT.classForName(RT.java:1504) > at clojure.lang.Compiler$FnExpr.getCompiledClass(Compiler.java:3202) > ... 24 more > nil > > Did I miss anything? > > Many thanks, > nt > > --------------------------- > [1] For reference here is the code from instance.clj > > (ns clojure.examples.instance > (:gen-class > :implements [java.util.Iterator] > :init init > :constructors {[String] []} > :state state)) > > (defn -init [s] > [[] (ref {:s s :index 0})]) > > (defn -hasNext [this] > (let [{:keys [s index]} @(.state this)] > (< index (count s)))) > > (defn -next [this] > (let [{:keys [s index]} @(.state this) > ch (.charAt s index)] > (dosync (alter (.state this) assoc :index (inc index))) > ch)) --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---