Minecraft crashing on startup in Ubuntu

I recently installed Ubuntu 20.04 instead of Windows for various reasons and I installed Minecraft.
When I open it and run version 1.8.9 it crashes almost instantly.
This is the error I get when launching the game:

Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
    at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
    at org.lwjgl.LinuxSysImplementation.(LinuxSysImplementation.java:50)
    at org.lwjgl.Sys.createImplementation(Sys.java:131)
    at org.lwjgl.Sys.(Sys.java:116)
    at ave.J(SourceFile:2539)
    at net.minecraft.client.main.Main.main(SourceFile:41)

Solution 1:

  • Searching for (the first two lines of) the error led me to this question on StackOverflow, saying

    "one of the more common causes of this exception is a missing or corrupt installation of a Java Access Bridge."

    The accepted answer also mentions to follow the instructions for installing here.

  • Alternatively, it could be indicative of a "headless Java installation".
    One of the comments in this bugthread mentions that

    "We should make it clear in the description of the tarball install on minecraft.net that non-headless java is needed (openjdk-8-jre)."