Counterclockwise User Documentation
All things listed here should work.

What is Counterclockwise ?

Counterclockwise is best described as an Integrated Development Environment for the Clojure language.
It is an extension of the popular Eclipse IDE.

Goals of Counterclockwise:

Counterclockwise bundles everything for hacking Clojure Code:

Install Counterclockwise

Install as a Standalone Product

Current Version is 0.25.3-SNAPSHOT

1. Download

Windows 32 Bits / Windows 64 Bits
Linux 32 Bits / Linux 64 Bits
OS X 64 Bits

2. Unzip

This will create a Counterclockwise-0.25.3-SNAPSHOT directory (application directory for OS X)

3. Start

Launch the Counterclockwise executable for your platform, located inside the Counterclockwise-0.25.3-SNAPSHOT directory


  • Java Virtual Machine (JVM) 7 installed and setup in the Operating System’s PATH

Install as an Eclipse Plugin



  • Java Virtual Machine (JVM) 7 running Eclipse

  • Eclipse 4.3 (Kepler) highly recommanded. Eclipse 3.7 (Indigo) still supported.

    • any packaging including JDT (Java Development Tools) will do: "Eclipse SDK" package, "Eclipse for Java Developers" package, "Eclipse for Java EE Developers" package, etc.

Configure Counterclockwise

Proxy Settings (optional)

Currently Counterclockwise does not use the Window ▸ Preferences ▸ General ▸ Network Connections Proxy Preference for use with the embedded Leiningen.

So to make it use a proxy, you’ll have to create the appropriate environment variable(s) and make them available when you start the Counterclockwise / Eclipse executable.

  • http_proxy: URL of an HTTP proxy.
    e.g. http_proxy=http://username:password@proxy:port

  • https_proxy: URL of an HTTPS proxy.
    e.g. http://username:password@proxy:port

  • http_no_proxy: list of hosts for which the proxy just declared should be bypassed.
    e.g. http_no_proxy="*|*|*"

See the Leiningen HTTP Proxies page for more detail.

Test a Counterclockwise install

Create and run a simple Clojure project ("Hello Betty")

  • Open the Java perspective

    • Window ▸ Open Perspective ▸ Java '(a perspective is a predefined layout of views, suitable for a particular type of development)'

  • Create a Clojure project

    • Menu File ▸ New ▸ Clojure Project, name it myproject

    • The project is created using the default Leiningen Template, which creates a Clojure project with a predefined myproject.core namespace in src/myproject/core.clj

  • Add a function definition to myproject.core:

    • Open src/myproject/core.clj, add the following at the end: (defn hello [who] (str "Hello " who " !")), save the file

  • Run the project:

    • With file src/myproject/core.clj open, Hit Ctrl+Alt+S (Cmd+Alt+S on OSX). This sends the whole file’s code to the REPL (and also takes care of starting a REPL for the project if none is currently started)

  • Switch to the REPL in the namespace of your file:

    • Hit Ctrl+Alt+N (Cmd+Alt+N on OSX). Alternatively, just click on the bottom of the REPL inside the "text input area"

  • Call your function (Hit Enter to send the expression if the cursor is at the end, or hit Ctrl+Enter / Cmd+Enter if the cursor is not at the end of the text):

> 1:1 helloworld=> (hello "Betty") [Ctrl+Enter]
> "Hello Betty !"

Enable Clojure (Leiningen batteries included)

No matter where you’re coming from, there’s a quick path towards enabling Clojure support for your project:

Create a new project

Use the wizard named Clojure Project.

  • Open File ▸ New ▸ Clojure Project (**)

    • In the wizard, choose a project name (the project folder will be named after the project name), and a location for where to create the project folder (if you don’t like the default one)

  • "Leiningen template" field:

    • By default it uses the "default" template

    • You can change it to use another lein-newnew template released somewhere in a maven repository (generally in clojars) (*)

Press the Finish button, that’s all. You have a fully working Leiningen project with its Java Build path (aka class path) managed by Counterclockwise.


(*) Lein2’s Lein-newnew plugin allows you to create new leiningen projects from "project templates".
To find the list of currently available project templates, you can ask clojars for "lein-template" artifacts :


(**) If you don’t see the File ▸ New ▸ Clojure Project menu entry: check that you’re in the "Java" or "Plugin Development" Perspective ( Window ▸ Open Perspective ▸ ) If you still don’t see the command, then Reset your Perspective ( Window ▸ Reset Perspective …)

Open a non-Eclipse project present in the filesystem

You have in your disk this wonderful project cloned from Github, which is managed by Leiningen, since it has a project.clj file in its root folder.

If you can see a .project file in its root directory:

  • Import it as a "general" project via the File ▸ Import ▸ Existing project into Workspace Wizard.

If you don’t have a .project file in the root directory:

  • Create a new project via File ▸ New ▸ General ▸ Project (After entering the name of your project, uncheck the Use default location checkbox, and check Browse to find your project folder on the file system)

    Once referenced as an Eclipse project, you should see it in the Package Explorer View

  • Open the contextual menu of your project, select Configure ▸ Convert to Leiningen Project

Add Clojure support to a Leiningen projet present in your Eclipse Workspace

You already have the project referenced in Eclipse, it has a project.clj file and you want its class path to be managed by Counterclockwise:

  • Open the contextual menu of your project, select Configure ▸ Convert to Leiningen Project

Add Clojure support to a non-Leiningen project present in your Eclipse Workspace


  • manage to get somehow the Clojure jar in your project’s Java build path settings (e.g. manually, or via some maven/gradle/whatever tool integrated with Eclipse) ⇒ the project will automatically be recognized as a Clojure Project

INFO: You can check the project has been recognized as a Clojure project via the presence of a menu:Clojure menu entry in the project’s contextual menu.

Leiningen Support

To ensure Eclipse recognize your project as a Leiningen Project, see the previous Enable Clojure (Leiningen batteries included) section.

Project classpath management

Eclipse has its own way of managing the Classpath, and so does Leiningen. Counterclockwise reconciles the two:

  • A new node named "Leiningen dependencies" inside your project in the Package Explorer View

    • This is an addition to the classpath containing all dependencies (including transitive ones) declared in project.clj (a Classpath Container in Eclipse terminology):

    • It is automatically updated when changes in project.clj are detected (your changes, or changes you get by refreshing the project, merging from Git, etc.)

    • New dependencies are automatically downloaded from remote repositories (no need to call lein deps)

  • The source paths for the project’s class path have been adjusted, taking into account the contents of project.clj's :source-paths, :java-source-paths, :resources-paths, etc.

  • A new menu:Leiningen entry in the contextual menu of your project, with commands:

    • menu:Reset the project configuration : recreates from scratch the class path (Java build path in Eclipse terminology) of your project from project.clj's content. Useful if you’ve messed up with the class path manually.

    • menu:[Update dependencies] : Forces the "Leiningen dependencies" Classpath container to refresh itself (only, the other Classpath entries are not reset)

Of course, when you have an active REPL, and once a namespace from a dependency’s jar has been loaded in the REPL, you can open vars from this namespace as usual, via F3, Ctrl+Click / Cmd+Click in the REPL or from the editor, and also by double-clicking on the var from the Namespace Browser.

Native deps are also correctly supported. Meaning you can start hacking with Overtone or Quil and their Sound / OpenGL supports right now!!!

Generic Command launcher

It is possible to invoke arbitrary leiningen command, as if done from the command line, via the Alt+L L keyboard shortcut.

If called from a place in Eclipse where it’s possible to infer a current project (e.g. if called from the context of a clojure editor), the command will be issued from the project folder, and the popup will show the project name at the start of the line, before the $.

my-project $ lein <task>

If called from a place in Eclipse where no project has been inferred from the current context, then the command is initialized to work outside any project folder.

<noproject> $ lein <task>

The text <task> is already selected in the text input, ready to be replaced by the real command you want to invoke. Replace the text with the command, uberjar or do clean, uberjar for instance, then hit Enter.

Wait for a second, and see the Console View show the progress of the process' output. You can also interact with the process input stream by typing inside the Console View.

Keyboard Shortcuts for Leiningen Commands

Starting a Headless Leiningen REPL

Alt+L H is a shortcut for launching a headless leiningen REPL. It is similar to doing Alt+L L + typing your-project $ lein repl :headless.

Resetting the Project Classpath

Alt+L R resets the project classpath, using Leiningen to compute the classpath.

Updating the Project Dependencies

Alt+L U is a shortcut for updating the project dependencies in the classpath, using Leiningen

Leiningen general purpose prompt

Alt+L G is a shortcut for opening a popup allowing you to invoke any leiningen command. More detail in the Generic Command launcher section.

Clojure Support

Clojure Support (aka Clojure Nature in Eclipse terminology) is automatic.
It is triggered by the presence of the clojure.core namespace in the classpath.

It is possible, though, to fall back to a manual mode if this automatic feature does not work well in your configuration:

Evaluate Clojure code

From a specific clojure file

  • Select the file

  • Select Run as clojure in its contextual menu

Note: a REPL will also be created. By default, if the selected file contains a (ns) call, the name of its namespace will be used. You can disable this behavior via the Clojure ▸ General ▸ Automatic namespace load on start and on save checkbox in the Eclipse Preference.[1]

Launch a REPL for the project

  • Select your project in the Package Explorer View

    • in the project’s contextual menu : Run as … ▸ Run configurations ▸ Clojure ▸ New

    • Press Run

  • A java process is started in the background, and a Console View is created in Eclipse for you to interact with it (view input/output, terminate the process, etc.)

  • A nRepl server is automatically launched is the java process, and a REPL View is created in Eclipse for you to interact with the nRepl server.

YOU MUST HIT Ctrl+Enter (Cmd+Enter on OS X) to send the expression for evaluation.
It is possible to configure which files should be automatically loaded on project java process startup.

Namespace Browser View

The Namespace Browser View displays all symbols of all namespaces of the active REPL.[2].
It allows you to jump to the definition of symbols in the relevant files (including inside jars): just double-click on the symbol name in the Namespace Browser View.

  • If you let the mouse hover a node in the browser, you will have the documentation, if available.

  • You can filter the Namespace Browser View's tree to more easily find a symbol.
    Just type a regexp in the menu:[Find :] text zone at the top of the Namespace Browser View. It will filter the tree for those symbols matching the regex (also when the symbol documentation matches the regex).

  • To see the Namespace Browser View, you either

    • select it via the Window ▸ Show View ▸ Other ▸ Counterclockwise Views ▸ Namespace Browser menu

    • open the java perspective.

      The Namespace Browser View should be stacked behind the Outline View (if you are in the Java Perspective.[3] and don’t see the Namespace Browser View, you may reset the Java Perspective.footnoteref[perspective] to its default value via the Window ▸ Reset Perspective … menu, or find it manually via the Window ▸ Show View ▸ Namespace Browser menu)

How does it work ?

When you have launched the REPL, Counterclockwise has embedded "server code" in the launched clojure environment. This server code is contacted by Counterclockwise to give information on the running clojure environment. The Namespace Browser feature uses this server to provide you with the most possible up to date information on Clojure Namespaces and their contents.

Debug Clojure code

Edit Clojure code

Create a new Clojure file

Clojure files must be located in java source directories.

The Clojure Editor is automatically launched when double-clickin on .clj (Clojure), .cljs (ClojureScript) and .edn (EDN) files.

If you place Clojure files outside of a java source directory, you will not be able to load it via the REPL, select it as an automatically loaded file in the launcher customization wizard …
  • To create a Clojure file/namespace, invoke the File ▸ New ▸ New Clojure file menu entry.

  • Inside a java source directory, follow the classical Clojure conventions to place your files, according to the namespace it belongs to. (e.g. you want to create namespace 'tests.clojure.first , then create java package "tests.clojure", and create clojure file first.clj in it.

Clojure Editor Features

Syntax higlighting

  • Rainbow parenthesis (different colors for different nesting levels)

  • Higlights as an error closing parens/brackets which have no corresponding opening ones

You can customize Syntax Highlighting via the Clojure ▸ Colors and Fonts Eclipse Preferences.footnoteref[preferences]

Code Completion

Code Completion is automatically suggested as you type.

Counterclockwise does suggestions for Clojure namespaces and symbols.

Code Completion is really powerful, because it features "fuzzy completion".
Examples: - if you type defm, then defmacro will match - if you type dmcro, defmacro will also match - if you type c.c/dmcro, defmacro will match, and chances are you’ll get a shortest liste of suggestions as well


You can prevent automatic suggestion of completions via the Clojure ▸ Editor ▸ Auto Activate code Completion Eclipse Preference.footnoteref[preferences]
You would then activate Code Completion suggestions by typing Ctrl+Space (Windows / Linux) / Cmd+Space (OS X)

Errors reporting

to be confirmed

In conjunction with auto-compile functionality, compilation problems are reported as problem markers : you see a summary of the problems in the problems view, you see the files that have problems in the package explorer, you see the problems at the correct line in the corresponding editor, you can jump to the editor at the correct line by double clicking on the problem in the problems view.

Keyboard Shortcuts

The Editor is really keyboard commands friendly. See the list of Keyboard Bindings: List of Keyboard Shortcuts

Interaction with a launched REPL

You’ll find the commands for interacting with a REPL from an Editor in the Keyboard Shortcuts page

Auto-build feature

Once you have started a REPL for your project, and when the Project ▸ Build automatically menu entry is selected, Eclipse will use a background connection to this REPL to automatically compile and evaluate the files you edit.

Package your work

Distribute as a jar

  • Use the Eclipse File ▸ Export as Jar Wizard

Create a "fat" executable jar with all dependencies packaged into

There’s a community contributed Eclipse Plugin for this task, called Flat Jar.

Install the Fat Jar plugin

Once installed, to create an executable jar, open the contextual menu of the project, and select the Fat jar menu entry.

The only trick is that if the class you want as the Main class is generated in the classes folder (e.g. a gen-class), then Fat Jar will not suggest it in the list of candidates, but you can still type its fully qualified named instead of triggering the candidates list.

If you also save the configuration via the corresponding button, it wil then be easy to invoke the same jar build later again.

Please refer to the Fat Jar plugin homepage for more detail

There is also an out-of-the-box "create Executable Jar" feature in Eclipse, but we encountered problems with it when the main class is not located in the source folders of the project, as is the case when you generate the main class from a clojure namespace.

User Plugins

This feature only works with Counterclockwise Standalone or Counterclockwise installed as a plugin on an Eclipse 4 installation.

It is possible to extend Counterclockwise / Eclipse yourself using the Clojure programming language.

Contributions must be placed in .clj files inside your ~/.ccw/ folder.

Content in ~/.ccw/ folder is processed as such:

The idea behind this layout is that users will share plugins via git repositories, and each plugin can directly be cloned into its own directory inside ~/.ccw/.

INFO: a User Plugin is dynamic. To remove it, just delete its folder inside ~/.ccw/.


Example 1: Hello World - single script file

(ns hello-world
  (:require [ccw.e4.dsl  :refer :all]
            [ccw.eclipse :as e]))

(def msg
  "This popup provided to you from a user script")

(defn greet [context]                                ; <1>
  (e/info-dialog "Hello world" msg))

(defcommand greeter "Hello from CCW")                ; <2>
(defhandler greeter greet)
(defkeybinding greeter "Ctrl+Alt+Y")
  1. greet is the function that implements the command behavior, it takes a context argument which in real-world situations can be used to gather contextualized information concerning the execution (what’s the current editor/view, the current selection, gather a preference value by key, etc.)

  2. defcommand, defhandler and defkeybinding are macros from namespace ccw.e4.dsl. They dynamically contribute to the Eclipse Application Model. Those contributions are tagged specifically so that it is easy to manage them from CCW (automatic removal, for instance, should you remove the plugin, or update the command name, etc.)

The script is placed directly inside ~/.ccw/ to demonstrate how easy it is to start contributing. In real world situations you will probably create one folder per plugin.

Example 2: Hello World - script file and companion namespaces

Here the Hello World user plugin is placed in its own subdirectory.
This also demonstrates how to split a plugin into script + companion namespaces.

(ns hello-world
  (:require [ccw.e4.dsl :refer :all]
            [user.greet :as g]))

(defn greet [context] (g/greet-popup))

(defcommand greeter "Hello from CCW")
(defhandler greeter greet)
(defkeybinding greeter "Ctrl+Alt+Y")
(ns user.greet
  (:require [ccw.eclipse :as e]
            [user.util :refer (text)]))

(defn greet-popup []
  (e/info-dialog "Hello world" (text)))
(ns user.util)

(defn text [] "This popup provided to you from a user script")
the hello-world subdirectory will only be recognized as a plugin if there is no .clj file inside ~/.ccw/

Example 3: Dynamic Reload of User Plugins

A somewhat meta example, which shows that User plugins have access to Counterclockwise Internals.
This plugin adds a command that calls Counterclockwise’s start-user-plugins function to dynamically reload user plugins without the necessity to restart the IDE.

(ns reload
  (:require [ccw.e4.dsl :refer :all]
            [ccw.eclipse :as e]
            [ccw.core.user-plugins :as p]))

(defn reload [context]
    (e/error-dialog "User plugins"
      "User plugins have been restarted successfully!")
    (catch Exception e
      (e/error-dialog"User plugins" (str
        "An error occured while starting User plugins: \n"
        (.getMessage e))))))

(defcommand start-user-plugins "Start/restart user plugins")
(defhandler start-user-plugins reload)
(defkeybinding start-user-plugins "Alt+U S")

1. Windows > Preferences on Linux and Windows, Eclipse > Preferences… on OS X
2. active-repl,The active REPL is the last REPL you interacted with
3. In Eclipse a Perspective is a named layout of Views. You can switch Perspectives while working, depending on the task at hand. Eclipse offers a Java Perspective and a Java Debugging Perspective among others