Stupid Java questions

7 views
Skip to first unread message

Anand Patil

unread,
Feb 3, 2009, 1:19:22 PM2/3/09
to Clojure
Hi all,

I'm using the system java on Mac OS Leopard, and confused about how to
get the parallel library working. I've got the necessary jar file on
my classpath:

sihpc03:clojure anand$ echo $CLASSPATH
/usr/local/clojure:/Library/Java/Extensions
sihpc03:clojure anand$ ls /Library/Java/Extensions/
clojure.jar jline-0.9.94.jar
jsr166y.jar libsvnjavahl-1.jnilib libsvnjavahl.jnilib

and I include it when I start up clojure:

sihpc03:clojure anand$ java -server -cp
jline-0.9.94.jar:jsr166y.jar:clojure.jar jline.ConsoleRunner
clojure.lang.Repl

However, when I try to load parallel.clj from the clojure source
directory, a problem happens:

user=> (load-file "parallel.clj")
java.lang.ClassNotFoundException: jsr166y.forkjoin.ParallelArray
(parallel.clj:0)

How can I fix that?


Another question: in the example on the clojure webpage, the load-file
command is (load-file "src/parallel.clj"). To make that work do I have
to have clojure's source directory on my classpath, or my regular
path, or are the sources available from inside the jar file somehow?

I'm sure the answers are available from Java documentation somewhere,
but the fact that I'm working from closure adds a thick enough layer
of confusion that I considered this worth posting... hope I'm not
taking advantage.


Thanks,
Anand

Zak Wilson

unread,
Feb 3, 2009, 1:22:53 PM2/3/09
to Clojure
I had similar results when I compiled jsr166y myself. There's a jar in
the group's files that is known to work.

Anand Patil

unread,
Feb 3, 2009, 1:38:02 PM2/3/09
to Clojure
Thanks Zak,

With the other jar I could load parallel.clj without errors, but I
wasn't able to refer to the parallel namespace as on clojure.org/
other_libraries, nor was preduce present in the user namespace:

user=> (load-file "parallel.clj")
nil
user=> (refer 'parallel)
java.lang.Exception: No namespace: parallel (NO_SOURCE_FILE:0)
user=> preduce
java.lang.Exception: Unable to resolve symbol: preduce in this context
(NO_SOURCE_FILE:0)

Also, the word 'jsr166y.jar' on clojure.org/other_libraries should
probably point to the working jar.

Thanks,
Anand

Anand Patil

unread,
Feb 3, 2009, 4:09:08 PM2/3/09
to Clojure
OK, I get it:
- parallel.clj writes into the namespace 'clojure.parallel, not
plain 'parallel as written on clojure.org/other_libraries
- parallel.clj needs to be on my path, not my classpath.

That wasn't so bad, but It'll be easier if the examples on the website
were brought up to date.

Cheers,
Anand

Zak Wilson

unread,
Feb 4, 2009, 4:45:32 AM2/4/09
to Clojure
The namespace is correct on clojure.org/api, but there it doesn't
mention that it has a dependency that isn't included with Clojure.

Clojure has been evolving very quickly, and sometimes the website
doesn't keep up. It might be nice if somebody could take charge of
making sure the site is up to date, but right now I'd rather keep
being thrilled by the fact that the feature I find myself needing
today was just added yesterday.

Anand Patil

unread,
Feb 4, 2009, 7:38:00 AM2/4/09
to Clojure
I agree & don't mean to complain. I'm just flagging the issues to make
it easier for whoever goes through the docs after clojure 1.0 is
tagged.

Anand
Reply all
Reply to author
Forward
0 new messages