0

I tried to run simple program which needs prxml library like in this example. Unfortunately, when I do (use 'clojure.contrib.prxml) I get

FileNotFoundException Could not locate clojure/contrib/prxml__init.class or clojure/contrib/prxml.clj on classpath:   
clojure.lang.RT.load (RT.java:443)

I am running this in REPL on Fedora 18 with these packages installed

  • clojure.noarch
  • clojure-contrib.noarch
  • clojure-compat.noarch
  • clojure-maven-plugin.noarch

EDIT

It seem to work when I run my REPL through Leiningen with lein repl. So what's the difference regarding to that library?

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
  • 1
    possible duplicate of [Could not locate clojure/core/async\_\_init.class or clojure/core/async.clj on classpath](http://stackoverflow.com/questions/20037682/could-not-locate-clojure-core-async-init-class-or-clojure-core-async-clj-on-cla) – Nathan Davis Nov 30 '13 at 22:13
  • do you have the right dependency set in the `project.clj` file? – guilespi Nov 30 '13 at 22:29
  • No, I just typed `repl` to open clojure `REPL` environment and entered the command. – Petr Mensik Nov 30 '13 at 22:32
  • I think you have to put a dependency in project.clj and restart the repl, that worked for me ([prxml "1.3.1"]). I'm not using repl/linux so I don't know step by step. That's kind of an old series – Levin Magruder Dec 01 '13 at 14:26

1 Answers1

0

I think the "normal" way to do this is to use leiningen, and create a project.clj with your dependencies, and start the repl with that project in effect. BUT, there is a (deprecated) add-classpath. Here's a session (under windows shell):

PS C:\clojure> java -cp .\clojure-1.5.1.jar clojure.main
Clojure 1.5.1
user=> (add-classpath "file:///c:/tmp/prxml-1.3.1.jar")
WARNING: add-classpath is deprecated
nil
user=> (use 'clojure.contrib.prxml)
nil
user=> (prxml [:root [:hello "add-classpath"]])
<root><hello>add-classpath</hello></root>nil
user=>

I got the jar onto my pc in the first place using leiningen.

Levin Magruder
  • 1,905
  • 18
  • 26