Clojure可以这样安装吗?
我下载了 Clojure 1.2 https://github.com/downloads/clojure/clojure /clojure-1.2.0.zip ,将其解压到 /Library 目录下,创建 CLOJURE_HOME,将 $CLOJURE_HOME/script 添加到我的 $PATH 中。
当我尝试运行位于脚本目录下的 clj 或 repl 脚本时,出现以下错误:
线程“main”中出现异常 java.lang.NoClassDefFoundError: jline/ 控制台运行器 引起原因:java.lang.ClassNotFoundException:jline.ConsoleRunner 在 java.net.URLClassLoader$1.run(URLClassLoader.java:202) 在 java.security.AccessController.doPrivileged(本机方法) 在 java.net.URLClassLoader.findClass(URLClassLoader.java:190) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:307) 在 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:248)
好吧,jline.jar 不在 CLASSPATH 中,所以我检查了 clj 和 repl 脚本:
CLASSPATH=src/clj:test:test-classes:classes/:script/jline-0.9.94.jar:../clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar
if [ -z "$1" ]; then
exec java -server jline.ConsoleRunner clojure.main
else
SCRIPT=$(dirname $1)
export CLASSPATH=$SCRIPT/*:$SCRIPT:$CLASSPATH
exec java -Xmx3G -server clojure.main "$1" "$@"
fi
我在 $CLOJURE_HOME/script 下下载了 jline.jar 但我仍然得到同样的错误。
这引出了我的问题:
https://github.com/downloads/clojure/ 的作用是什么clojure/clojure-1.2.0.zip 无论如何?
它应该用来安装 Clojure 吗?或者只是为了构建并获取 clojure.jar?
我注意到没有人谈论以这种方式安装 Clojure。
我错过了什么吗?
I downloaded Clojure 1.2 https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip , extracted it under /Library directory, created CLOJURE_HOME, added $CLOJURE_HOME/script to my $PATH.
When I'm trying to run clj or repl scripts that are located under script directory, I'm getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError: jline/
ConsoleRunner
Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Ok, jline.jar isn't in the CLASSPATH so I checked clj and repl scripts:
CLASSPATH=src/clj:test:test-classes:classes/:script/jline-0.9.94.jar:../clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar
if [ -z "$1" ]; then
exec java -server jline.ConsoleRunner clojure.main
else
SCRIPT=$(dirname $1)
export CLASSPATH=$SCRIPT/*:$SCRIPT:$CLASSPATH
exec java -Xmx3G -server clojure.main "$1" "$@"
fi
I downloaded jline.jar under $CLOJURE_HOME/script but I'm still getting the same error.
This lead me to the question:
What is the role of https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip anyway?
Is it supposed to be used to install Clojure? or just to to build and get clojure.jar?
I noticed no one is talking about installing Clojure this way.
Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Clojure 作为一种 JVM 语言,必须处理 JVM 类路径。这使得“安装”它有点笨拙和混乱。与其这样自己安装,不如尝试一些像 cljr 和 cake 之类的工具。我写了一篇关于此的博客文章,可能会有所帮助:http://blog.raynes.me/?p =48
总之:查看cljr,蛋糕,和 leiningen。
Clojure 社区中的大多数人都没有“安装”Clojure。大多数人使用构建工具和/或 cljr。当您不可避免地需要依赖管理时,将 Clojure 安装到一个中心位置并没有多大意义,而且无论如何 jar 都会被复制到各处。无论如何,让工具为您处理类路径要容易得多。
Clojure, being a JVM language, has to deal with the JVM classpath. This makes 'installing' it a bit unwieldy and confusing. Rather than install it yourself like this, try out some tools like cljr and cake. I wrote a blog post about this that might be helpful: http://blog.raynes.me/?p=48
In summary: Check out cljr, cake, and leiningen.
The majority of people in the Clojure community don't have Clojure 'installed'. Most people use a build tool and/or cljr. It doesn't make a lot of sense to install Clojure to a central place when, inevitably, you're going to need dependency management, and jars will be copied around everywhere anyway. In any case, it's much easier to let a tool handle the classpath for you.
clojure.zip 文件的存在是为了让编写工具的人有一个地方可以放置他们的工具来获取他们需要的部分;)
对于不编写工具的人来说,他们要么正在使用 github 上的最新分支,所以他们可以通过git pull 或者他们正在使用上面提到的 lineden、cake、cljr、counterclocking(eclipse)、la clojure (intellij) 或 netbeans。
the clojure.zip file exists so people who write tools will have a place for their tools to get the parts they need ;)
For people not writing tools they are either working on/with the latest branch from github and so they get Clojure with a git pull or they are using the above mentioned liningen, cake, cljr , counterclockwise(eclipse), la clojure (intellij), or netbeans.