Apache Ant is a Java library and tool that has several built-in tasks allowing one 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 students or new users 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 system that runs on desktops, laptops, servers, and other devices. To get started with installing Apache Ant on Ubuntu, please follow the steps below:
Install OpenJDK 8
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 install OpenJDK. To do that, run the commands below: After installing Java, you can verify it by running the commands below: It should output something similar as shown below: After, continue below to install Apache Ant.
Install Apache Ant via Apt
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: To verify if Ant is installed, use the commands below: It should output a similar line as below: That’s how to install Apache Ant via Apt-get
Install Apache Ant using SDKMAN
You can also install Apache Ant via the 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. After installing, you should see an output similar to the one below: Next, activate it Lastly, run the following code snippet to ensure that the installation succeeded: If all went well, the version should be displayed. Something like: After installing SDKMAN, simply run the commands below to install Apache Ant. After installing, it should output a similar message as below: When finished, you can verify whether Ant is installed successfully or not by checking its version:
Download and Install Ant Manually
If you want to manually download and install Apache Ant yourself, simply follow the steps below: You can download Ant distribution from the Apache Ant website. Currently, the latest release of Ant is version 1.10.7. To download, run the commands below, then extract them. The above command will unpack the Ant distribution to /usr/local/apache-ant-1.10.7 Next, create a symbolic link to the Ant distribution by running the commands below. After that, create an ant. sh, file at /etc/profile.d folder. Copy and paste these lines into the file and save it. Save the file and exit. After that, run the command below to activate the above environment variables. You can verify the Ant version by running the commands below: Notice the latest version is now used? Conclusion: This post showed you how to install Apache Ant on Ubuntu 20.04 | 18.04. If you find any error above, please use the comment form below to report it. Thanks, You may also like the post below: