Java How to install clojure on linux

Java How to install clojure on linux

To install Clojure on Linux, you will need to have the Java Development Kit (JDK) installed on your system. You can check if the JDK is already installed by running the following command:

r‮e‬fer to:lautturi.com
java -version

If the JDK is installed, the command will print the version number. If the JDK is not installed, you will need to install it before you can install Clojure. You can download and install the JDK from the Oracle website (https://www.oracle.com/java/technologies/javase-downloads.html).

Once the JDK is installed, you can install Clojure using one of the following methods:

  1. Using the Leiningen build tool:

Leiningen is a popular build tool for Clojure that makes it easy to install and manage Clojure projects. To install Leiningen, you will need to have Git and a Java runtime environment (JRE) installed on your system. You can install Git and the JRE using your system's package manager, such as apt-get or yum.

Once Git and the JRE are installed, you can install Leiningen by running the following command:

curl -L https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > /usr/local/bin/lein

This will download the Leiningen script and save it to the /usr/local/bin directory. To make the script executable, run the following command:

chmod +x /usr/local/bin/lein

To test that Leiningen is installed correctly, run the following command:

lein

If Leiningen is installed correctly, the command will print a list of available commands.

To install Clojure using Leiningen, create a new project using the lein new command:

lein new myproject

This will create a new project directory called myproject with a basic Clojure project structure and a project.clj file that specifies the dependencies for the project. To start a Clojure repl (read-eval-print loop) for the project, navigate to the project directory and run the following command:

cd myproject
lein repl

This will start a repl with the Clojure dependencies specified in the project.clj file.

  1. Using the Clojure command-line tools:

The Clojure command-line tools are a standalone installation of Clojure that includes the clj command-line tool and the clojure library. To install the Clojure command-line tools, you will need to have Git and a Java runtime environment.

Created Time:2017-11-03 23:27:08  Author:lautturi