How To Install libunsafe-mock-java on Debian 10

Learn how to install libunsafe-mock-java on Debian 10 with this tutorial. libunsafe-mock-java is Java library providing backported sun.misc.Unsafe class from JDK 8

Introduction

In this tutorial we learn how to install libunsafe-mock-java on Debian 10.

What is libunsafe-mock-java

libunsafe-mock-java is:

sun.misc.Unsafe is Java class in Oracle JDKs that provides a collection of methods for performing low-level, unsafe operations.

Although the class and all methods are public, use of this class is limited because only trusted code can obtain instances of it.

unsafe-mock provides a current version of sun.misc.Unsafe that supports all APIs up through the new “fences” API in Java 8 EA builds b71 and later. This Unsafe is a copy of the one from Java 8 EA build b71, and it is expected that if you want to build against it you put it in javac’s bootclasspath. You are responsible for determining in your own code whether you can access Unsafe and which methods are available; this library is only to provide an all-inclusive Unsafe against which you can compile using JDKs <= 8.0.

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

Install libunsafe-mock-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 libunsafe-mock-java using apt-get by running the following command:

sudo apt-get -y install libunsafe-mock-java

Install libunsafe-mock-java Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libunsafe-mock-java

Install libunsafe-mock-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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install libunsafe-mock-java

How To Uninstall libunsafe-mock-java on Debian 10

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

sudo apt-get remove libunsafe-mock-java

Uninstall libunsafe-mock-java And Its Dependencies

To uninstall libunsafe-mock-java and its dependencies that are no longer needed by Debian 10, we can use the command below:

sudo apt-get -y autoremove libunsafe-mock-java

Remove libunsafe-mock-java Configurations and Data

To remove libunsafe-mock-java configuration and data from Debian 10 we can use the following command:

sudo apt-get -y purge libunsafe-mock-java

Remove libunsafe-mock-java configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libunsafe-mock-java

Dependencies

libunsafe-mock-java have the following dependencies:

References

Summary

In this tutorial we learn how to install libunsafe-mock-java package on Debian 10 using different package management tools: apt, apt-get and aptitude.