Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Easy to use clojure download

branch: master
README.textile

Dejour

de jour (adj) Available and being served on this day.

Dejour provides an easy, works out of the box experience for the Clojure programming language. Clojure is a JVM-hosted, functional, general-purpose LISP variant that is especially adept at concurrent programming. You can find the clojure source and original downloads at http://clojure.org.

Unfortunately, while clojure.org provides the superb Clojure language as well as clojure-contrib (a set of useful libraries) there are a few things missing. The most important missing bit is a script that will run Clojure. Also missing is the very useful JLine providing a more robust interactive clojure interpreter or REPL.

The Dejour project pulls all of this together in a single easy to get, easy to install download. Dejour currently works on Linux, Macs, and Windows.

Installing Dejour

Step one is to download the latest Dejour tar or zip from:

http://github.com/russolsen/dejour/downloads

Step two is to unpack Dejour. You will end up with a directory with a name like dejour-1.1.0. Inside that directory is a bin directory, containing a Linux/Mac script, clj as well as a couple of Windows executables. If you are running on Linux or a Mac, you can run clojure by running the clj script. If you are on windows you have a choice of clj.exe which will run clojure with a console or cljw.exe which will run clojure without a console.

*nix example (paths will vary):


    $ cd ~/lib
    $ tar xf ~/Downloads/dejour-complete-1.3.0c.tar

Step three is probably to put the dejour bin directory on your your path.

*nix example (paths will vary):


    $ export PATH=$PATH:~/lib/dejour-complete-1.3.0c/bin

Step four There is no step four.

Examples

If you just want the clojure REPL (i.e. interactive shell), simply run the clj script (or clj.exe on Windows):


    $ clj
    Clojure 1.1.0
    user=>

If you want to execute a file full of clojure code, call out the file after clj:


  clj my-clojure-code.clj

If you want to pass arguments to your clojure script, just hang them on the end of the command:


  clj my-clojure-code.clj some arguments

If you need to pass a -D or -X argument to java, put it before the clojure file:


  clj -Xmx500M -DFoo=bar  my-clojure-code.clj some arguments

If you have other java VM arguments, you can pass them in via the -J option:


  clj -J -d32 my-clojure-script.clj arg1 arg2

Dejour also comes with some simple examples of Clojure code from my “Clojure, the least you need to know” talk. You will find these in the examples subdirectory.

Using the clj script

If you run the script with no parameters, clj will bring up the interactive clojure ‘interpreter’: You can simply type in clojure code and immediately see the results. Alternatively, if you supply clj with the name of a clojure script, it will run that script.

The clj script and executable are designed to be very simple for beginners to use, but they are also capable of doing more elaborate things. Here are the arguments that clj understands:

  • -debug Just print out the java command and exit.
  • -no-jline Don’t use jline
  • -rlwrap Use rlwrap command instead of jline. Assumes that rlwrap is on your path.
  • -rlwrap-cmd Specify the rlwrap command (and any parameters) in the next arg
  • -cp <jar or directory> Add the next argument to the classpath
  • -classpath <jar or directory> Add the next argument to the classpath
  • -Dname=value Define the given Java system property, passed directly to java.
  • -Xjava-option Passed directly to Java
  • -client Use the java client VM
  • -server Use the java server VM
  • -hotspot Turn on java hotspot
  • -J java-option Pass the next argument directly to java.
  • -- (That’s two dashes) Treat everything that follows as a clojure argument

Dejour is also location independant. It will run out of wherever you decide to unpack it — no environment variables required. The only external dependancy that Dejour has is on Java: It assumes that there is a java command in your path, or that JAVA_HOME is set. If you have both, JAVA_HOME wins.

Dejour also pays attention to two rlwrap related environment variables (if you don’t know what rlwrap is then you don’t need to worry about this). The two variables are: CLJ_USE_RLWRAP which turns on rlwrap support by default and CLJ_RLWRAP_CMD which specifies and alternative rlwrap command (other than the default ‘rlwrap’) and any rlwrap arguments.

ToDo

“Art is never finished, only abandoned.” I don’t know if dejour is art, but it certainly ain’t finished. Here are some of the things still left undone:

  • There is some support in the clj script for Cygwin, but I would welcome feedback from any Cygwin users out there

Contributors

Dejour was created by Russ Olsen and is, of course, based on Clojure, clojure-contrib and JLine. Much of the clj script was inspired by the Jruby startup script, jruby.sh. Also inspired by Mark Reid’s clj script. Thanks to Fogus for some help with the README file. Thanks to Colin Jones for pitching in.

See my website at russolsen.com

License

Copyright © 2010-2011 Russ Olsen and released under the Apache 2.0 license.

Something went wrong with that request. Please try again.