I have a problem with the Enclojure REPL and using clojure modules from it. The Load/Change REPL to file/ns works fine with an isolated clojure file, but breaks with a file which has references to another clojure file which I try to use from my project.
Here are the exact steps:
- Create a new project.
- Create a clojure module foobar.clj (namespace com.acme.foobar)
Define a function which returns a value in foobar.clj:
(ns com.acme.foobar (:use com.acme.othermodule))
(defn myfunc1 [] "a")
Open a Netbeans IDE REPL
From foobar.clj's context menu select:
- Change REPL to file/ns
- Load
From REPL call the (myfunc1) function. This works just fine:
com.acme.foobar=> (myfunc1) "a"
The problems start when when I try to refer to other files from foobar. Here's what I do:
Create a new clojure module othermodule.clj
(ns com.acme.othermodule)
(defn fromothermodule [] "b")
Now try to call this from foobar.clj:
(defn myfunc2 [] (fromothermodule))
From othermodule.clj's context menu I select:
- Change REPL to file/ns
- Load
To make the REPL realize that there is new module it should be able to run.
- I do same things things to foobar.clj which now refers to othermodule.clj, but I get:
CompilerException java.io.FileNotFoundException: Could not locate com/acme/othermodule__init.class or com/acme/othermodule.clj on classpath: (NO_SOURCE_FILE:50) com.acme.foobar=>
This error message comes from both "Change REPL to file/ns" and "Load"
What am I missing? Should I do some other tricks to make this happen? Even the desperate measure of Run->Clean and Build the main project doesn't help (that would of course make the REPL business pretty painful anyway).
I am using NetBeans 6.7.1 and enclojure-plugin-2009-11-3.nbm.