How To Install libjavaparser-java on Ubuntu 18.04

In this tutorial we learn how to install libjavaparser-java on Ubuntu 18.04. libjavaparser-java is Java library for parsing Java 7

Introduction

In this tutorial we learn how to install libjavaparser-java on Ubuntu 18.04.

What is libjavaparser-java

libjavaparser-java is:

The library features abstract syntax tree (AST) generation and supports the visitor pattern. The AST records the source code structure, javadoc and comments. It is also possible to change the AST nodes or create new ones to modify the source code.

Main features are:

  • light weight
  • good performance
  • easy to use
  • AST can be modified
  • AST can be created from scratc

There are three methods to install libjavaparser-java on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libjavaparser-java Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libjavaparser-java using apt-get by running the following command:

sudo apt-get -y install libjavaparser-java

Install libjavaparser-java Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libjavaparser-java using apt by running the following command:

sudo apt -y install libjavaparser-java

Install libjavaparser-java Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libjavaparser-java using aptitude by running the following command:

sudo aptitude -y install libjavaparser-java

How To Uninstall libjavaparser-java on Ubuntu 18.04

To uninstall only the libjavaparser-java package we can use the following command:

sudo apt-get remove libjavaparser-java

Uninstall libjavaparser-java And Its Dependencies

To uninstall libjavaparser-java and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libjavaparser-java

Remove libjavaparser-java Configurations and Data

To remove libjavaparser-java configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libjavaparser-java

Remove libjavaparser-java configuration, data, and all of its dependencies

We can use the following command to remove libjavaparser-java configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libjavaparser-java

References

Summary

In this tutorial we learn how to install libjavaparser-java package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.