To use lein run, you need to do two things:

1) Write a -main function (defn -main [] ... ) in whatever namespace you 
like (you could put it in the core namescape, like you did in your echo 
statement for the (println "foo")). For example:

(defn -main []
  (println "foo"))

2) Specify which namespace holds this main function in your project.clj file 
in the root of your project. It's just another entry, like :dependencies, 
and it looks like this:

:main foo.core

Now when you run 'lein run', it will find your main function in that 
namespace and run it. If this seems a bit random, it's part Clojure's Java 
heritage. It's basically a shortcut for running your program as if it were 
an exectuble jar, which must have a "main" function that acts as an entry 
point for the program. The command 'lein run' allows you to treat your 
program as an executable jar without having to actually run 'lein uberjar' 
and then execute it separately.

-Daniel

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