Install Groovy on Ubuntu 16

Problem

If you need to have groovy on your server you can installed it very easy via SDK man. The other advantage of this installation is that you will be able to manage versions of groovy and do updates when is needed.

Prerequisites

Groovy requires java. If you want to check do you have java you can do:

java -version

result is:

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

In case that you don't have java you can follow this instructions to install it: Install java 8 on Ubuntu 16

Solution Install Groovy with SDK man

  • First you need to install tools that will help you with the installation:
sudo apt-get install unzip zip curl

You need to have zip/unzip tool and curl - command for downloading the files from the web.

  • Now you need to get SDK man by:
curl -s get.sdkman.io | bash

Follow the installation process.

  • Reload the terminal by( or open new one):
source "$HOME/.sdkman/bin/sdkman-init.sh"
  • Install groovy (latest and stable) by:
sdk install groovy
  • Verify installation by:
groovy -version

result will be similar to:

Groovy Version: 2.4.12 JVM: 1.8.0_161 Vendor: Oracle Corporation OS: Linux