1

In a .clj file I have (use '(incanter core io ...)). This error occurs when attempting to evaluate that code: FileNotFoundException Could not locate clojure/core/matrix__init.class or clojure/core/matrix.clj on classpath: clojure.lang.RT.load (RT.java:443). If I change the code to just this: (use '(incanter)), then all is OK except that none of the necessary namespaces are available, which is to be expected. I have been using jEdit with the clojure plugin quite happily for the past 18 months and closely verified that my classpath was OK. I tried (use '...math.combinatorics) and the csv & json jars (these all worked OK) to be reasonably sure it wasn't a jEdit config problem. I looked for 'matrix' in the clojure/core jar, but did not find it. Any help to solve this problem greatly appreciated.

After further investigation: I think I have found the source of my problem: in the clatrix-0.3.0 namespace declaration clojure.core.matrix is required. When I remove clatrix from the classpath and evaluate (use '(incanter core ...)) this error occurs: FileNotFoundException Could not locate clatrix/core__init.class or clatrix/core.clj on classpath: clojure.lang.RT.load (RT.java:443). When clatrix is added to the classpath then my original error occurs (i.e. can't find clojure.core.matrix). Incanter-core does have a Matrix.class file. It seems incanter depends on clatrix which depends on clojure.core. matrix which doesn't exist. How does one solve this problem or is there a work-around?

Brian
  • 129
  • 1
  • 9
  • 1
    [clojure.core.matrix](https://github.com/mikera/core.matrix) does not come with clojure.core. – noisesmith Jan 24 '14 at 17:33
  • Also, if you use [leiningen](http://leiningen.org/) to resolve dependencies and build the classpath, it will automatically find the libraries your various libraries need. – noisesmith Jan 24 '14 at 17:34
  • 1
    I use leiningen for full builds. I find jEdit an easy & useful editor for developing and testing clojure functions and modules. – Brian Jan 24 '14 at 19:02
  • Then you need to manually resolve your dependencies. – noisesmith Jan 24 '14 at 19:22
  • 3
    Regarding your edit: you still don't understand. Clojure.core.matrix exists. I linked to it above. If you use lein lein will provide it automatically. If you decide to resolve dependencies by hand, then you need to find it and put it in the class path. – noisesmith Jan 25 '14 at 15:24
  • Furthermore, you will need to find all of its dependencies (declared in its pom.xml or project.clj) and put those in your classpath too. And their dependencies as well. Etc. It is easier to use a tool, since the dependencies are declared in a way that is designed to be used by automated tools. Lein is one such tool. – noisesmith Jan 25 '14 at 15:29

1 Answers1

3

The problem here is that you are not providing the transitive dependencies for your library. clojure.core.matrix is not part of clojure.core. Clearly whatever method Jedit uses for running Clojure does not detect or resolve your dependencies for you.

While this dependency resolution can be done by hand, it is a less error prone task, and less time consuming, to let leiningen resolve your dependencies and set up your class path during development, and use the lein repl task to start your interactive repl during development. Lein repl starts an nrepl server, which has a well defined API that multiple editors / programming environments can connect to. A good editor for clojure development should provide some method of connecting to an nrepl server.

noisesmith
  • 20,076
  • 2
  • 41
  • 49
  • Hopefully Alex Ott can shed some light on the additional information pertinent to my problem above as this does seem to be related to Incanter. – Brian Jan 25 '14 at 15:03
  • 2
    No. The problem is that it has dependencies that you did not provide. There is no problem with incanter. You need to provide its dependencies, or use a tool that provides them automatically. – noisesmith Jan 25 '14 at 15:21