On 14 Wrz, 19:51, Michael Wood <esiot...@gmail.com> wrote:
> (...)
> What does your "runclojure" script look like?

Yes, that's the point. If the problem isn't in the Clojure itself, nor
in the source file, and the files are placed exactly where they should
be, the only possibility is the script used to run Clojure.

I'll explain it here.

First of all, I don't name my script "runclojure", I name it "clj".
I'm too lazy to type so many characters; I used the name "runclojure",
because it's more descriptive.

The script is composed of two parts.

The first part is responsible for handling the classpath given in the
arguments passed to the script. This classpath is saved in the
variable CP. (This variable starts either with the : character, or is
empty.)

Then, the second part of the script is executed. In the old version of
my script, this part was as follows:

(cd /path/to/my/clojure/dir
 exec java -cp jline-0.9.94.jar:clojure-1.0.0.jar$CP \
               jline.ConsoleRunner clojure.lang.Repl)

So, the JVM was run in my Clojure directory. Thus, the java classpath
returned by the getProperties method was simply:

"jline-0.9.94.jar:clojure-1.0.0.jar:
/home/tpj/test/classes:/home/tpj/test/src"

Please note, that both the jline and clojure jars are given without
any paths - they are placed in the current working directory.
Obviously, all my source files aren't - and it was the cause of my
problems.

I changed the second part of the script to:

BASECP="/path/to/my/clojure/dir"
exec java -cp $BASECP/jline-0.9.94.jar:$BASECP/clojure-1.0.0.jar$CP \
          jline.ConsoleRunner clojure.lang.Repl

Now, the java classpath returned by the getProperty method is as
follows:

"/path/to/my/clojure/dir/jline-0.9.94.jar:
/path/to/my/clojure/dir/clojure-1.0.0.jar:
/home/tpj/test/classes:/home/tpj/test/src"

And the compilation works as expected.

Although I still don't understand why the current working directory
can cause such problems (shouldn't Java be able to make proper use of
the classpath?), my problem has been solved.

Thank you all for your answers, for your *other* point of view on this
problems, which helped me so much!
--~--~---------~--~----~------------~-------~--~----~
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