开发者

How to Execute Clojure File?

开发者 https://www.devze.com 2023-03-20 07:22 出处:网络
How can I run a clojure file/script, 开发者_运维知识库which uses clojure-contrib, from the command line? My (winodws) machine has clojure-1.2.1.jar and clojure-contrib-1.2.0.jar on the classpath. Note

How can I run a clojure file/script, 开发者_运维知识库which uses clojure-contrib, from the command line? My (winodws) machine has clojure-1.2.1.jar and clojure-contrib-1.2.0.jar on the classpath. Note: I can start the REPL with: java clojure.mainand I can execute *.clj files that DO NOT use clojure-contrib with: java clojure.main file-name.clj


You need to add the clojure-contrib jar to the classpath. Since you are using windows, you add multiple classpaths by separating the entries with semicolons.

 java -cp clojure-1.2.1.jar;clojure-contrib-1.2.0.jar clojure.main file-name.clj

The above code should enable you to run your file-name.clj script which depends on clojure-contrib.


This line will run a clojure script "hello-world.clj". It first adds the clojure jar to the class path first and then will execute the file.

java -cp clojure.jar clojure.main hello-world.clj


for those used to text editor + lots of shell work

lein run isn't bad and lein projects can help you organize deps and other proj-specific

0

精彩评论

暂无评论...
验证码 换一张
取 消