How can I run a .clj Clojure file I created?

2019-03-08 07:35发布

I've installed Geany on my Linux Mint machine and I wrote some simple code. Just a small hello world to get started with the language.

Now I'd like to run it and see what it outputs.

How can I run this code? I'm not using an IDE or something that's pre packaged, just the simple text editor Geany.

What command should I run?

8条回答
神经病院院长
2楼-- · 2019-03-08 08:21

You can run script with following command:

java -cp clojure.jar clojure.main file.clj

but it's better to use leiningen, especially when you'll start to add dependencies to your project. lein provides number of commands to run your code (with all necessary dependencies), pack code into archive with lein jar, or create complete, independent archives with lein uberjar that you can run with:

java -jar your_app.jar

command

P.S. You can read how to use lein in following article - it describes base tasks & configurations

查看更多
Bombasti
3楼-- · 2019-03-08 08:21

Drip is probably now the best answer to this question (see Drip's wiki for details on using Drip with Clojure).

Cake was incorporated into Leiningen and has since been superseded as the most stable implementation of Clojure automation by Drip - see this answer to a similar question here.

查看更多
登录 后发表回答