If you're just looking to run a script that happens to be on the classpath, you can do so by prepending an '@' character to the classpath-relative path to the script.

So, if a directory foo is on your classpath, and a clojure file you'd like to run is at foo/bar/script.clj, then you can run it with:

java -cp <your_classpath_here> clojure.main @/bar/script.clj

FWIW, this is noted in the documentation for clojure here:

http://clojure.org/repl_and_main

Cheers,

- Chas

On Jun 18, 2010, at 6:15 PM, Paul Moore wrote:

I've just seen a couple of postings which, if I'm not mistaken, imply
that it's possible to have a Clojure script in my classspath. Is that
right? I come from a Python background (little or no Java experience)
and the idea that anything other than .class or .jar files (or
directories) could be on the classpath never occurred to me.

Can anyone give me a complete example of how this works? (I probably
need to get the file names and namespaces right, something I'm still
struggling with - again the Java/JVM requirements for filenames that
match classnames is a new concept for me).

Could I have found anything about this on the web? The Java
documentation (http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html )
didn't mention anything other than classes/jars/zips/directories, and
my Google skills didn't turn up anything clojure-specific.

Thanks,
Paul.

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

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