如何在 Windows 上安装 clojure-contrib?
我似乎找不到启动包含 contrib 库的 Clojure REPL 的方法。如果我正确理解了文档,那么这个命令应该可以做到:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar:clojure
-contrib.jar clojure.main
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: clojure.main. Program will exit.
但正如你所看到的,它失败了。我确实将 clojure-contrib.jar 复制到了 C:\clojure-1.1.0
文件夹。
有人可以帮我做对吗?
更新
感谢 Michał 的帖子,我注意到我的错误是使用冒号,而我必须使用分号。这有效:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar;clojure-contrib.jar clojure.main
Clojure 1.1.0
user=>
I can't seem to find a way to launch the Clojure REPL with the contrib library included. If I understood the documentation correctly then this command should do it:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar:clojure
-contrib.jar clojure.main
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: clojure.main. Program will exit.
But as you can see, it fails. I did copy the clojure-contrib.jar to the C:\clojure-1.1.0
folder.
Can someone help me get it right?
Update
Thanks to Michał's post I noticed that my error was using a colon where I had to use a semi-colon. This works:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar;clojure-contrib.jar clojure.main
Clojure 1.1.0
user=>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(答案已更新以使实际解决方案明确,而它在原始中有些隐藏......)
Windows 上的类路径字符串使用
;
作为分隔符。例如,或者,您可以使用通配符将给定目录中的所有 jar 包含在类路径中(这是 JDK 1.6 的补充,不适用于 1.5):(
我认为这里使用双引号是可以的在 Windows 中,无法检查...)
(Answer updated to make the actual solution explicit, whereas it was somewhat hidden in the original...)
The classpath string on Windows uses
;
as the separator. E.g.Alternatively, you can use a wildcard to include all jars in the given directory in the classpath (that's a JDK 1.6 addition, wouldn't work with 1.5):
(I think using double quotes here is ok in Windows, can't check though...)