简体   繁体   中英

running clojure in eclipse (counterclockwise)

I'm learning clojure on eclipse (counterclockwise plugin).

  • When I click "run" in eclipse (as I would do with Java) I get not only the console opened but this "REPL" window. Why is it necessary and what does it do?
  • When I click "run" it takes quite a few seconds to launch the app. Is there a way to make it faster?
  • When I need to edit the code and relaunch (run) the the app I'm getting this message: "The selection cannot be launched, and there are no recent launches". What is that and why wouldn't it let me relaunch my code? If I wait a while I can launch it again.

This is simple bit of code that I'm trying to run:

(ns ClojureTest.core)

(let [input (read-line)]
  (if (= "x" input)
    (do
      (println "Exit")
      (System/exit 0)
    )
    (do
      (println input)
      (recur)
    )
  )
)

UPDATE: I managed to screw it up even further. Now when I click "Run" the console ignores any input as if the application wasn't even running...

UPDATE2 I've restarted eclipse and the previous problem was solved. Now I can run the app in the console again. I have no idea what happened. The only difference I can see is that when I messed it up - the REPL window title looked like this:

REPL @ nrepl://127.0.0.1:60429 (user)

And after restarting eclipse it came back to this:

REPL @ nrepl://127.0.0.1:60001 (ClojureTest.core)

I have no idea what this means.

You only need one open REPL per project. Once opened, you can evaluate changed code from an existing file (namespace), by choosing so from the Clojure menu. The selection or entire file, depending on what you choose, is then sent to the REPL for evaluation. You can try out your changes immediately by calling functions from the REPL. This is called interactive development. There is no need to recompile your entire project, before you can try out changes.

The developers of CCW just chose the action for the Run button to be 'open a REPL for the existing project'. Use it only once and don't keep pressing it, while developing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM