How to Install Apache Groovy on Ubuntu 20.04
by Richard Zayzay Posted on 08/09/2020
This brief tutorial shows students and new users how to install Apache Groovy on Ubuntu 20.04 | 18.04.
For the uninitiated, Apache Groovy is a powerful, dynamic language for Java platform that helps developers create programs with easy to learn syntax.
It is great tool, and integrates smoothly with any Java program which enables developers to create better applications with powerful features, including scripting capabilities, and many more.
If you’re a Java developer who’s going to be developing applications, integrating Apache Groovy with your codes should be something you might want to do.
For more about Apache2 Groovy, please check its homepage.
To get started with installing Apache Groovy on Ubuntu, follow the steps below:
Step 1: 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 the remove obsolete packages from your system. It’s also a good to reboot the server after running the above commands.
Step 2: Install OpenJDK 8
To properly use Apache Groove, you will need Java installed. First, download the Java 8 Development Kit: either the official Oracle JDK or Open JDK
For this tutorial, we’re going to be 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 installing Apache Groovy.
Step 3: Download Apache Groovy
Now that Java is installed, you can go and download and install Groovy. There are many ways to get Groovy installed Ubuntu. However, the quickest and easiest way is to 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 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 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 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 lunch 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 20.04 | 18.04.
https://websiteforstudents.com/how-to-install-apache-groovy-on-ubuntu-20-04-18-04/