Hi,

The trick is to get contrib on the class path of java so it can find the
content of the library.
The class path defines were Java will search for the components (classes
in Java) to load while running.
Clojure code is compiled on the fly and ends up as a being loaded as a
Java class and may be present
in libraries either as .clj files or as pre-compiled Java classes
(.class files).

So:

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

clojure.main being the main program called (in this case it starts a
REPL) and -cp (ClassPath) being the list of librairies you want to
use.

The libraries are colon delimited and I think it's the same on both
Windows and u*x.

-server is used for performance reasons. It modifies the behavior of the
Java virtual machine and makes it run faster
for our purpose.

This should get you started.

Luc




On Mon, 2010-05-10 at 14:48 -0700, Mat wrote:

> Hi all,
> I am totally new to clojure and this is a very simple question, but I
> spent the last two hours trying to figure this out and I need help.
> 
> I'm not able to use the clojure-contrib library and I am not able to
> find instructions here on this group and anywhere on the web. Maybe
> because this should be easy, but for me it isn't.
> 
> I downloaded the clojure-contrib.jar but I can't find anywhere
> instruction on the set-up (where to put the file, if some else is
> needed, ecc) to begin with.
> 
> Actually I have the clojure-contrib.jar file in the same directory as
> the clojure.jar, but I don't know how to run it.
> 
> I've tried running the REPL normally, but when try using
> 
> (ns mynamespace
>   (:use clojure.contrib.string))
> 
> in my code file (or using :require in place of :use) i get this error:
> 
> java.io.FileNotFoundException: Could not locate clojure/contrib/
> string__init.class or clojure/contrib/string.clj on classpath:
> (NO_SOURCE_FILE:2)
> 
> I thought then that the library must be loaded in the same command
> with clojure.jar. I tried to look on the web and found some script and
> I tried to figure out what to do from them. What I tried last is
> 
> java -cp clojure.jar clojure.main clojure-contrib.jar
> 
> and I get this error
> 
> Exception in thread "main" java.lang.Exception: Unable to resolve
> symbol: PK in this context (clojure-contrib.jar:0)
> 
> I'm not sure that what I'm doing is correct, but it's all I was able
> to figure out in two hours of trial and error. I don't know anything
> about running java from the command line. Every page I find on the
> internet on clojure-contrib just assumes that everything works and
> just uses the library.
> 
> I hope that someone can help me.
> Thank you very much.
> 
> Matteo
> 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to