Software⏱️ 3 min read📅 2026-06-04

How to Fix: What exactly does `update-alternatives` do?

Update-alternatives command used for managing alternative packages in Linux.

Quick Answer: The update-alternatives command is used to manage alternative packages, such as Java versions, by installing a new package and specifying its priority. It differs from adding jdk to the path by allowing multiple versions of the same package to be installed and managed.

The command `update-alternatives` is used to manage alternative versions of executables on Linux systems. It allows users to specify which executable should be used when multiple versions are available. This can be particularly useful for developers who need to use specific versions of tools or libraries for development purposes.

Using `update-alternatives` is different from adding a JDK to the path because it provides a more explicit and flexible way of managing alternative executables. With `update-alternatives`, you can specify the priority and location of each executable, whereas adding a JDK to the path simply updates the system's PATH environment variable.

If you have run the command `sudo update-alternatives --install /usr/bin/java java /usr/local/java/jre1.7.0_09/bin/java 1` without understanding what it does, you may want to revert back to the original state by removing the alternative executable and restoring the system's default behavior.

To revert back to the original state, you can use the `sudo update-alternatives --remove java /usr/local/java/jre1.7.0_09/bin/java` command to remove the alternative executable, followed by a `sudo update-alternatives --reset java` command to reset the system's default behavior.

In conclusion, `update-alternatives` is a powerful tool for managing alternative versions of executables on Linux systems. By understanding how it works and using it correctly, you can improve your development workflow and ensure that your system behaves as expected.

⚠️ Common Causes

    ✅ Best Solutions to Fix It

    Update System Settings

      Alternative Advanced Fix

        ✨ Wrapping Up

        Did this fix your problem?

        If not, try searching for specific error codes.

        🔍 Search Error Database