4

I normally use Emacs but was inspired to try CCW + Eclipse again. I have a Clojure test project with a source file src/user.clj with the following contents:

(ns user)

(println "hi")

I have a REPL which I started with Window->Show View->Other->Clojure Views->REPL.

When I select the println expression (all of '(println "hi")') and hit Command-enter, the expression itself gets echoed in the REPL window, but no output occurs. Similar with expressions like '(take 10 (range))'.

If I type the expression in the REPL directly, and hit Enter, I get

=> (take 10 (range))

but there doesn't seem to be any additional output of the evaluation.

Thanks for any ideas. I looked over the docs but nothing obvious jumped out at me.

JohnJ
  • 4,753
  • 2
  • 28
  • 40

2 Answers2

5

You need to be connected to a REPL to get a response.

There are two options:

  • Connect to an existing REPL
  • Run your project as a Clojure application and automatically connect to it's REPL.

To connect to an existing REPL, you can use Window -> Connect to REPL.

To run your project, Right click your project; Run As -> Clojure Application. If that's not an option, Right Click -> Configure -> As Clojure Application

deterb
  • 3,994
  • 1
  • 28
  • 33
  • Neither of the "run your project" suggestions worked exactly, but simply Run->Run worked for me. Problem solved, thanks! – JohnJ Sep 07 '12 at 03:45
  • Out of curiosity, what was available/happened when you tried to run as a Clojure Application (the second)? Also, the first one isn't so much to run it through Eclipse, but to take an existing Clojure runtime and connect to it (like what you would do with SLIME). – deterb Sep 07 '12 at 11:05
  • Sorry, I can't duplicate the problem I had -- Run As... -> Clojure Application works for me now. Thanks again for the help. – JohnJ Sep 07 '12 at 15:28
4

Sounds like your REPL is disconnected - it needs to be connected to a running Clojure process in order for you to interact with the live environment.

I usually just launch a REPL and load the file simultaneously by pressing Ctrl-Alt-L in the code editor window.

mikera
  • 105,238
  • 25
  • 256
  • 415