本文介绍了无法获取clojure-contrib加载 - FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过clojure-contrib.jar在我的文件系统的各种地方,我已经尝试手动指定类路径时启动REPL,我已经尝试解压缩jar并将clj文件放在类路径,没有什么似乎工作。我继续得到这样的:

I have tried putting clojure-contrib.jar various places on my filesystem, I have tried manually specifying the classpath when launching the REPL, I have tried extracting the jar and putting the clj files on the classpath, nothing seems to work. I continue getting something like this:

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

当我执行(println(seq(.getURLs(java.lang.ClassLoader / getSystemClassLoader))))看到类路径,它包括clojure-contrib:

When I execute (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))) to see the classpath, it does include clojure-contrib:

(#<URL file:/C:/Program%20Files/Java/jre1.6.0_06/lib/clojure-1.0.0.
jar> ... #<URL file:/C:/Program%20Files/Java/jre1.6.0_06/lib/clojure-contrib.jar>)

当我创建一个自己的.clj文件并将其放在类路径上时,我可以使用或需要它,并且可以访问其功能

When I make a .clj file of my own and put it on the classpath I am able to use or require it and have access to its functions as I'd expect.

如果我把一个.clj文件 - str-utils.clj例如 - 移动到pwd(在类路径上),它sorta工作 - 它至少找到该文件,虽然它通常不能做任何事情,因为它依赖于其他功能埋没在clojure-contrib,它找不到。

If I move a .clj file - str-utils.clj for instance - to the pwd (which is on the classpath) it sorta works - it at leasts finds the file, although it generally can't do anything with it because of dependencies on other functions buried in clojure-contrib which it can't find.

推荐答案

如果你编译自己的clojure-contrib jar,使用不兼容的主分支。

If you compiled your own clojure-contrib jar, you probably used the main branch which is not 1.0 compatible.

按照 doc来签出1.0标记的clojure-contrib修订版本。

Follow the Using clojure-contrib with Clojure 1.0 doc to checkout the 1.0 tagged revision of clojure-contrib.

还有保持1.0兼容性。

There is also a clojure-contrib git branch that maintains 1.0 compatibility.

这篇关于无法获取clojure-contrib加载 - FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 09:04