Foolproof installation of Clojure on Windows

Viewed 643

I'm now programming for more than 30 years and in this time tried a lot of programming languages. I've never seen a programming language as difficult to install as Clojure. Even Jython, which is also build for JVM, installs in seconds and instantly works properly.

For Clojure you have to fiddle around with downloading and installing scripts via shell, starting leiningen in background or trying to install add-ons for your favorite IDE. You stick to folder structure, have to set environment variables manually, ...

Is there any easy and foolproof way to install Clojure with a 'normal' editor or simple IDE on windows? (mostly preferred with an one-file-installer)

2 Answers

I haven't used Windoze much recently, but I have a nice template project that has everything you need to get started.

Clone the template project in git, then verify you have java and lein installed:

~/expr/demo > java --version
java 14 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

~/expr/demo > lein --version
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Leiningen 2.9.1 on Java 14 Java HotSpot(TM) 64-Bit Server VM

Assuming that works, you should be able to run the unit tests:

> lein clean 
> lein test

lein test _bootstrap

-------------------------------
   Clojure 1.10.1    Java 14
-------------------------------

lein test tst.demo.core

Ran 3 tests containing 8 assertions.
0 failures, 0 errors.

You can edit the source code with any editor or IDE you like. Note that the code is split into the src and test trees. The project even includes a sample of how to include Java source code if you need it (or you can delete that part).

Enjoy!

If you're going to use Leiningen, start with Leiningen; no need to install Clojure beyond what Leiningen installs for you. Then, look for a plugin for VS Code or whatever.

Related