On Jan 2, 2009, at 11:51 AM, Rayne wrote:

I checked, and the classpath (compile-path) is the "classes" directory
in my clojure folder, so I put the file in there, and tried to compile
it, it gave me

You'll need to learn a bit about Classpath to work with Clojure. Basically, Classpath is a list of root directories within which Java and Clojure files exist. By making the location of source files classpath-relative, Java and Clojure can find them on a particular machine even if its directory structure is not identical to that of another machine. By controlling what is and is not in the Classpath list, you can control what is and is not visible to a Java virtual machine.

In the case of compiling with Clojure, the Classpath set up at Clojure launch time must include the root directory that contains your source file and the root directory that will contain your compiled files and both of those directories must already exist.

Here's an example of setting classpath for compilation using the "-cp" option to java on unix:

        % mkdir source dest
        % # use an editor to create source/rayne.clj
        % ls -R source dest
        dest:

        source:
        rayne.clj
        % cat source/rayne.clj
        (ns rayne)
        
        (defn hi [] (prn "hi"))
        % java -cp clojure.jar:source:dest clojure.main
        Clojure
        user=> (binding [*compile-path* "dest"] (compile 'rayne))
        rayne
        user=>
        % ls -R source dest
        dest:
        rayne$hi__4.class       rayne__init.class
        
        source:
        rayne.clj
        %

This example is for Mac OS X/Unix and I know you're on Windows. I recommend using Google to search for Classpath on Windows to get some examples there. Java examples will probably be enough for you to adapt what I've shown to work in your case.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to