This brief tutorial shows students and new users how to install Apache Ant on Ubuntu 20.04 | 18.04.
Apache Ant is a Java library and tool that has number of built-in tasks allowing to compile, assemble, test and run Java applications. If you’re going to be developing Java apps, you may need Apache Ant to help automate the process.
For student or new user looking for a Linux system to learn on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners.
Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other device.
While learning Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.
To get started with installing Apache Ant on Ubuntu, please follow the steps below:
Apache Ant is a Java based app so you’ll 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 openjdk-8-jre-lib
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)
After, continue below to install Apache Ant.
Apache Ant comes via Ubuntu default repositories. However, the version with comes with Ubuntu repositories might not be the latest version. If you wish to install the latest, you may have to install it manually or via third party repositories.
To install Apache Ant using apt-get, simply execute the following commands:
sudo apt update
sudo apt install ant
To verify if Ant is installed, use the commands below:
ant -version
It should output similar line as below:
Output:
Apache Ant(TM) version 1.10.5 compiled on March 28 2019
That’s how to install Apache Ant via Apt-get
You can also install Apache Ant via SDKMAN tool.
SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. You’ll need to install SDKMan too.
Installing SDKMAN! on UNIX-like platforms is as easy as ever.
Run the commands below to download and install.
sudo apt install curl
curl -s "https://get.sdkman.io" | sudo bash
After installing, you should see an output as similar to the one below:
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!!!
Next, activate it
source "$HOME/.sdkman/bin/sdkman-init.sh"
Lastly, run the following code snippet to ensure that installation succeeded:
sdk version
If all went well, the version should be displayed. Something like:
==== BROADCAST =================================================================
* 2020-03-18: Gradle 6.3-rc-3 released on SDKMAN! #gradle
* 2020-03-17: Gradle 6.3-rc-2 released on SDKMAN! #gradle
* 2020-03-16: Leiningen 2.9.3 released on SDKMAN! #leiningen
================================================================================
SDKMAN 5.7.4+362
After installing SDKMAN, simply run the commands below to install Apache Ant.
sudo bash
sdk install ant
After installing, it should output similar message as below:
Installing: ant 1.10.1
Done installing!
Setting ant 1.10.1 as default.
When finishes, you can verify whether Ant is installed successfully or not by checking its version:
ant -version
#labs #linux ubuntu #apache ant #ubuntu 18.04 #ubuntu 20.04 focal fossa #linux