How to Install Apache Groovy on Ubuntu Linux

|

|

The content demonstrates a step-by-step tutorial on installing Apache Groovy, a powerful dynamic language for the Java platform, on Ubuntu 18.04 or 16.04. The process involves updating the server, installing OpenJDK 8, downloading and installing Groovy, and setting up the Groovy environment. Verification checks are run after key installation procedures to ensure successful setup.

This brief tutorial shows students and new users how to install Apache Groovy on Ubuntu 18.04 | 16.04.

Installing Apache Groovy on Ubuntu Linux provides Java developers with an easy-to-learn, dynamic language that integrates smoothly with Java programs. Groovy offers developers powerful features, including scripting capabilities, which enable them to create better applications.

By integrating Apache Groovy with Java, developers can create programs with easy-to-learn syntax that are powerful and dynamic. Additionally, Groovy can be used for various tasks, including scripting and testing.

Overall, installing Apache Groovy on Ubuntu Linux is a great choice for Java developers looking to create better applications with powerful features.

For more about Apache2 Groovy, please check its homepage.

To get started with installing Apache Groovy on Ubuntu, follow the steps below:

Prepare Ubuntu

Before installing packages on Ubuntu, you must first update the server. To do that, run the commands below:

sudo apt update
sudo apt dist-upgrade
sudo apt autoremove

Running the commands above will update and remove obsolete packages from your system. It’s also good to reboot the server after running the above commands.

Install OpenJDK 8

To properly use Apache Groove, you will need Java installed. First, download the Java 8 Development Kit: the official Oracle JDK or Open JDK.

For this tutorial, we’re going to install OpenJDK.

To do that, run the commands below:

sudo apt update
sudo apt-get install openjdk-8-jdk openjdk-8-doc

After installing Java, you can verify it by running the commands below:

java -version

It should output something similar, as shown below:

Output:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

Now that you have updated and installed Java, continue below to install Apache Groovy.

Download Apache Groovy

Now that Java is installed, you can download and install Groovy. There are many ways to get Groovy installed on Ubuntu. However, the quickest and easiest way is to use its install script.

To do that, run the commands below:

sudo apt install curl
curl -s get.sdkman.io | bash

When you run the command above, it should download all dependencies and prepare the server for Groovy.

After a successful installation, you should get a similar message as shown below:

Extract script archive…
Install scripts…
Set version to 5.7.4+362 …
Attempt update of interactive bash profile on regular UNIX…
Added sdkman init snippet to /home/richard/.bashrc
Attempt update of zsh profile…
Updated existing /home/richard/.zshrc
All done!
Please open a new terminal, or run the following in the existing one:
source "/home/richard/.sdkman/bin/sdkman-init.sh"
Then issue the following command:
sdk help
Enjoy!!!

After running the commands above, run the commands below to set the Groovy environment.

source "$HOME/.sdkman/bin/sdkman-init.sh"

Finally, run the commands below to install Groovy.

sdk install groovy

That should install Groovy and show a similar message as below after the installation:

==== BROADCAST =================================================================
2020-04-03: Grails 4.0.3 released on SDKMAN! #grailsfw
2020-04-03: Micronaut 1.3.4 released on SDKMAN! #micronautfw
* 2020-04-02: Micronaut 2.0.0.M2 released on SDKMAN! #micronautfw
Downloading: groovy 3.0.2
In progress…
############################################################################ 100.0%
Installing: groovy 3.0.2
Done installing!
Setting groovy 3.0.2 as default.

That should do it!

After installing, you can check whether Groovy is installed by displaying its version number.

groovy -version

It should then display a similar line as shown below:

Groovy Version: 3.0.2 JVM: 1.8.0_242 Vendor: Private Build OS: Linux

This is how to install Apache Groovy on Ubuntu!

To launch Groovy, run the command below:

groovysh

That should open Groovy shell.

Apr 05, 2020 5:10:31 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Groovy Shell (3.0.2, JVM: 1.8.0_242)
Type ':help' or ':h' for help.
groovy:000>

Conclusion:

This post showed you how to install Apache Groovy on Ubuntu 18.04 | 16.04. If you find any error, please report it in the comment form below.

Thanks,

You may also like the post below:


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Discover more from Geek Rewind

Subscribe now to keep reading and get access to the full archive.

Continue reading