On Sep 7, 1:00 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote:
> I think your problems should be solved now, since in my understanding
> they arise due to the non-adherence to the required file layout.> 
> java.io.FileNotFoundException: Could not locate Clojure resource
> > on classpath: bar/mycode/test.clj
>
>                  ^^^
> load-resources works namespace directory relative for relative  
> pathnames!
>

Thanks for the pointers Meikel.
I was finally able to get it to work.
I had missed one of the points in the docs for load-resources:

"A path is interpreted as classpath-relative if it begins with
a slash or relative to the root directory for the current
namespace otherwise"

Apart from trying the bar namespace approach mentioned
I also cleaned up my 'mycode' example.
I added a symlink to mycode in ~/.clj which I added to the classpath.
And updated the code below which works.

--- test.clj start ----
(in-ns 'mycode)
(defn foo [] :foo-called)
--- test.clj end ---

--- mycode.clj start ---
(ns mycode
  (:refer-clojure)
  (:load-resources "test.clj"))
--- mycode.clj end ---

--- interaction start ----
user=> (load-resources "/mycode/mycode.clj")
nil
user=> (mycode/foo)
:foo-called
user=>
--- interaction end ----

Parth

>  smime.p7s
> 5KViewDownload
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to