从 jar 导入 clojure 函数

发布于 2024-09-11 04:30:39 字数 916 浏览 4 评论 0原文

我正在使用 Clojure,但不知道如何从 clojure-contrib.jar 导入函数。根据 this 答案,我正在执行以下操作

:像这样 REPL:

 java -cp clojure.jar:clojure-contrib.jar clojure.main

然后尝试导入一个函数:

user=>  (use '[clojure-contrib.duck-streams :only (writer reader)])

它不起作用,并且出现以下错误:

java.io.FileNotFoundException:无法在类路径上找到 clojure_contrib/duck_streams__init.class 或 clojure_contrib/duck_streams.clj:(NO_SOURCE_FILE:0)

用点而不是破折号尝试也不起作用:

user=>  (use '[clojure.contrib.duck-streams :only (writer reader)])

我得到的错误大多相同:

java.io.FileNotFoundException:无法在类路径上找到 clojure/contrib/duck_streams__init.class 或 clojure/contrib/duck_streams.clj:(NO_SOURCE_FILE:0)

我做错了什么?

I'm playing around with Clojure, and I can't figure out how to import a function from clojure-contrib.jar. Working from this answer, I'm doing the following:

Running the REPL like so:

 java -cp clojure.jar:clojure-contrib.jar clojure.main

Then trying to import a function:

user=>  (use '[clojure-contrib.duck-streams :only (writer reader)])

It doesn't work, and I get the following error:

java.io.FileNotFoundException: Could not locate clojure_contrib/duck_streams__init.class or clojure_contrib/duck_streams.clj on classpath: (NO_SOURCE_FILE:0)

Trying it with a dot instead of a dash also doesn't work:

user=>  (use '[clojure.contrib.duck-streams :only (writer reader)])

I get mostly the same error:

java.io.FileNotFoundException: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath: (NO_SOURCE_FILE:0)

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼眸里的快感 2024-09-18 04:30:39

clojure.jarclojure-contrib.jar 是否在您当前的工作目录中?如果没有,您需要在 CLASSPATH 中指定 JAR 文件的完整路径。

Is clojure.jar and clojure-contrib.jar in your current working directory? If not, you need to specify the full path to the JAR files in the CLASSPATH.

影子是时光的心 2024-09-18 04:30:39

这应该可以工作

(use 'clojure.contrib)

我现在没有 clojure 方便检查,但

(use 'clojure.contrib :only (writer reader))

也应该可以工作

This should work

(use 'clojure.contrib)

I don't have clojure handy right now to check, but

(use 'clojure.contrib :only (writer reader))

should also work

情魔剑神 2024-09-18 04:30:39

它是 clojure.contrib,而不是 clojute-contrib。注意点与破折号。

It's clojure.contrib, not clojute-contrib. Note dot versus dash.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文