Question

I have a problem compiling .clj files which reside in a project where I run the nREPL server process:

  1. I've created a new project using lein new xxx.
  2. In the project folder I started up an nREPL by lein repl.
  3. In another terminal window I started a client lein repl :connect localhost:12345/repl.
  4. I created a simple namespace file and saved it inside the project in the appropriate location:

    (ns remote.one)
    (def foo 42)
    
  5. Now on the client terminal I called this function

    (compile 'remote.one) 
    

I've got the below exception:

CompilerException java.lang.ClassNotFoundException: remote.one, compiling:(C:\Users\xxx\AppData\Local\Temp\form-init2429492334116477513.clj:1:1)

Now I would have expected the compile call to be executed in the server not on the client. Can it be done at all?

Thanks

Was it helpful?

Solution

I just tried it and it worked for me. What happened the first time I tried it was that I missed a step: setting the current directory as the project's. I see that this step is also missing from your description, maybe that's the reason it doesn't work in your case.

  1. Create a new project using lein new remote.
  2. Change the current directory cd remote.
  3. Start the nREPL server from the project folder with lein repl :headless (which I realize now is also different from your description).
  4. Open a new console and start the nREPL client lein repl :connect localhost:port/repl in ~/..
  5. Create the file for the ns in ~/remote/src/remote/one.clj.
  6. From the client evaluate (compile 'remote.one).

(Using Leiningen 2.3.4 on Java 1.7.0 Java HotSpot(TM) 64-Bit Server VM and Clojure 1.5.1).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top