Exiting The REPL In Clojure

When­ever I’m learn­ing a new lan­guage, it always seems like it’s the lit­tle things that drive me mad. With that in mind, I’m going to try and post fixes to the lit­tle things as I make my way through Clo­jure. To that point, I rapidly got tired of clos­ing down the com­mand win­dow and start­ing a new one when I seri­ously hosed things up. Ctrl-D didn’t work though I think that’s the com­mand for Com­mon Lisp. As usual, Google knows every­thing and the com­mand is Ctrl-C.

Also, if you’re run­ning Clo­jure on Win­dows and want to be able to fire up the REPL from any­where, cre­ate a batch file called clojure.bat in your Windows\system32 folder and put the fol­low­ing line in it:
java –cp c:\clojure\clojure.jar clojure.lang.Repl

Then you can just type clo­jure at the com­mand prompt any­where and have the REPL start up in that direc­tory. This is help­ful once you start writ­ing larger pro­grams that aren’t located in the Clo­jure install folder.

3 Comments

  • […] that intro aside, I wrote about both start­ing and stop­ping the REPL here. In work­ing through the book, you need to have the clo­jure install direc­tory, the clojure-contrib […]

  • J Donald wrote:

    (. Sys­tem exit 0)

    will do it

  • JuanManuel wrote:

    If you also want to have a sim­ple short­cut to open the REPL cre­ate a short­cut and add this line to tar­get: ‘%JAVA_HOME%\jre\bin\java.exe –cp “F:\clojure_1.0.0\clojure-1.0.0.jar;clojure.jar” clojure.lang.Repl’ and this to Start in: ‘%JAVA_HOME%\jre\bin’
    Please note that the ’ (sin­gle quote is excluded and that this assume that the %JAVA_HOME% path is already set in your environment.

Leave a Reply

Your email is never shared.Required fields are marked *