ant command not found

In this troubleshooting guide we learn how to fix ant command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

ant: command not found

or when using sudo you get the following error message

sudo: ant: command not found

Solutions to ant: command not found

How To Fix ant: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu ant is provided by ant package.

ant is:

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.

This package contains the scripts and the core tasks libraries.

To fix this problem, we can install more using the command below.

sudo apt-get -y install ant

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install ant.

sudo apt -y install ant

Or if you have aptitude installed you can use the following command.

sudo aptitude install ant

Summary

In this tutorial we learn how to fix ant command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.