The previous version of this guide was extremely manual in nature.
It involved installing the JDK manually, together with Git, and much more.
It turns out that actually using Scoop after all, makes this whole process way more streamlined and neat.
In addition, using Clojure Development Environment (Windows) instead of the barebones Clojure Development Environment (Windows), is way easier for making the experience non-hair-pulling.
Especially things like the easy addition of an nREPL, or :build alias, together with easy dependency addition and updating, makes neil a really nice tool!
Together with Clojure Development Environment (Windows), this completely replaced my need for Leiningen!
Scoop
Scoop
Scoop is an easy to use command-line installer for Windows.
It significantly streamlines the experience of installing and managing software (especially for development purposes)!
And the best thing? It lives in user-space as much as possible!
Note
It is always recommended to reference up-to-date documentation, particularly Scoop’s own website when installing!
Install
Simply run the following command(s) from a PowerShell terminal:
Generally a simple scoop install <package> will suffice!
It could however be that the package is not contained within the default bucket.
Buckets are collections of packages, organized by categories, or even supplied by external repositories.
One of the most utilized buckets would be extras, for example.
To add a bucket, simply do scoop bucket add <bucket>.
Finally, to search for a package, you can do scoop search <package> and it will even show you what bucket it belongs to!
When developing a real project, I found Git to have some short-comings in conflict resolution and branch philosophy.
I found them to be completely mitigated by Jujutsu (jj)!
It uses Git under the hood, so it is completely possible to share jj repositories with other (git) users, or simply use it on existing Git repositories.
To an outsider it looks just like Git! Give it a read/try if you want.
Java
As Clojure runs on the JVM (Java Virtual Machine), we obviously need to install Java, specifically a JDK (Java Development Kit).
Excursion: JDK vs. JRE (+ different vendors)
Note the difference between a JRE (Java Runtime Environment) and a JDK (Java Development Kit)!
Many PCs probably have a JRE version installed, which will commonly be referred to an installed Java version.
This will not allow you to develop in Java!
That’s what the JDK is for!
Though, to be exact, every JDK commonly packages a matching JRE.
Also worth noting that the Java ecosystem has become somewhat … fragmented over the years.
Though the language is generally the same (of course for a specific Java version) there are many JDKs (from different vendors, too) out there with different licenses, and other head-spinning stuff.
Be it the Oracle JDK, OpenJDK, Eclipse Adoptium Temurin, and many more.
For me Temurin is one of the more hassle-free open-source non-sucky variants (on Windows).
The most pain-free approach is to install it, too, using Scoop!
Hint
You can, of course, also do a more manual approach, by downloading it, installing it and making sure JAVA_HOME is correctly set.
But as stated previously, scoop just Makes-It-Work™.
For that you simply have to add the java bucket and install the (TCK certified) Java runtime and compiler:
If you are sitting behind a corporate proxy, you need to set the proxy for Clojure (Maven to be exact) first!
Clojure/Maven both use the same centralized .\m2\settings.xml config file for that.
Under Windows the config file should be located (or not created) in your User directory (C:\Users\<username>)
Populate the file with, or add merge with already present sections (the relevant lines have been highlighted):
This is mainly for the clojure and deps.edn specific stuff to work.
Optional Tooling
There are some (of course, optional) tools I like to use.
I use Clojure Development Environment (Windows) for easily managing project dependencies, common aliases and for quick project creation, while I use Babashka for quick scripting that doesn’t warrant a whole project structure.
deps-new
For a new project (and as an alternative/fallback to neil), you can simply use deps-new, which setups a deps.edn project.
It doesn’t have shiny bling-bling, but works.
If you’re unfamiliar with clojure, the application template is pretty convoluted. Instead I’d recommend to use the minimal scratch template while getting started.
Look inside src/scratch.clj for some hints on running your first commands.
It has really nice feature, like an integrated terminal pane, versatile extensions and plugins, great LSP support and so much more that makes it a great IDE.
Simply download and install it from either the Microsoft Website using their installer, or using Scoop:
Of course, we want a nice development environment for Clojure.
This is why we’ll use Calva.
It’s a very nice batteries-included framework for Clojure development within VS Code.
To install it:
Open VS Code
Go to (in the menu bar)
File
Preferences
Extensions
Search for Calva
Select Calva: Clojure & ClojureScript
Click on Install
After that, simply open your project folder inside VS Code and Calva should automagically start everything, including clojure-lsp as the LSP server, their formatter and much more.
Generally, though, you should be able to use Ctrl+Alt+C for some Calva-specific commands (needs to be followed by command specific keys!), or use the general VS Code command palette/search using Ctrl+Shift+P!
You should try to use the “Jack-in” feature for Calva to start a REPL in you project directory, so you can easily evaluate any S-Expression, or in other non-LISPy words, statements enclosed in (...) (so, … everything really!) using Alt+Enter.
(Using the command palette, it’s called Calva: Start a Project REPL and Connect)
Also you might wonder why it auto inserts brackets and doesn’t let you delete it?!
Well as you might’ve guessed when looking at some Clojure source code, keeping track of the right number of parentheses is hard! So that’s why many use systems to keep track for them. Utilize the right keybinds/commands for that! For example search for slurp and barf commands (Ctrl+Shift+. and Ctrl+Shift+,) in the command palette and see what happens.
But as I said: Use the documentation!
Other Editors / IDEs
There are of course alternatives to Calva.
A non-exhaustive list is provided (the ones I have tried personally), though you should checkout the official Clojure Editors list for further suggestions.
Emacs
I’m in no position to call other people savage-madmans, but running Emacs on Windows, at least natively, is something I’ve long given up on.
If you value your sanity, use a WSL 2 - Distro for that!
In any case, have a look at Cider.
Cider is one of the most feature-complete implementations of a true LISP agnostic development experience I have encountered!
There’s a Cider equivalent (more or less) for Neovim called conjure (fittingly).
The good thing about it is that is also supports a bunch of other languages within and outside the LISP family, including but not limited to:
![quote]
Available to individuals purchasing the licence for their own use with their own money. May not be purchased or reimbursed by companies, but may be used at work by the named user. This licence is perpetual, with free updates for a year.
(EULA)