如何运行我创建的.clj Clojure文件? [英] How can I run a .clj Clojure file I created?

查看:406
本文介绍了如何运行我创建的.clj Clojure文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Linux Mint机器上安装了Geany,我写了一些简单的代码。



现在我想运行它,看看它的输出。



如何运行这段代码?



我应该运行什么命令?


<您可以使用以下命令运行脚本:

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

但最好使用 leiningen ,特别是当你开始添加依赖项到你的项目。 lein提供了运行你的代码(具有所有必要的依赖)的命令数,用 lein jar 打包代码到档案中,或者用 lein uberjar 可以运行:

  java -jar your_app.jar 

命令



PS您可以在以下文章中了解如何使用 lein 它描述了基本任务&配置


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?

解决方案

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

这篇关于如何运行我创建的.clj Clojure文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆