Sunday, 30 November 2008

AOT problem solved

Thanks to the swift responses of the Clojure google group I have got past my little problem. It was, of course, deceptively simple, but not clear to someone who doesn't do Java programming much.

The problem was basically that whatever I did I could not get Clojure to recognise that the source files existed in the classpath.

When you invoke java with the
-jar
command line option it completely ignores the classpath (both the environment variable, or the
-cp
argument.

So, when compiling my code I simply switch this:


java -cp ./classes:./src -jar ${HOME}/src/clojure/clojure.jar ./compile.clj


.. to this ...


java -cp ./classes:./src:${HOME}/src/clojure/clojure/jar clojure.lang.Script ./compile.clj


For the record the contents of
compile.clj
are as follows:


(binding [*compile-path* "/home/gteale/src/aot_test/classes"]
(compile 'de.teale.test))


I plan to replace that with either ant or lancet shortly.

No comments: