Reputation: 8481
When reading clojure -h
* I found the --main
option:
main options:
-m, --main ns-name Call the -main function from a namespace with args
Having the following code:
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!"))
Is it possible to utilize the --main
argument to call directly the -main
function without using lein
?
*clojure
= java ${JAVA_OPTS} -jar path_to_clojure.jar "$@"
Upvotes: 2
Views: 556
Reputation: 5052
Yes. Assuming -main function is in the file ./src/foo/core.clj
the following will run it:
java -cp "path_to_clojure.jar:src" clojure.main --main foo.core
(note the src
in the classpath)
Upvotes: 1