If installing the snap
version doesn’t solve the issue either, I saw out there that some Minecraft versions don’t work well with Ubuntu’s default openjdk JRE (a.k.a. “Java”).
An workaround for such problem consists in downloading and installing Oracle’s proprietary JRE (Java Runtime Environment) by hand and then setting its corresponding JVM (Java Virtual Machine) as the default (system-wide) JVM. In case you decide to install the official proprietary Oracle JRE, please run this very long command in the terminal:
if [ -d /opt/java ]; then sudo rm -rf /opt/java; fi; sudo mkdir /opt/java; if [ `getconf LONG_BIT` == 64 ]; then sudo wget https://javadl.oracle.com/webapps/download/AutoDL?BundleId=244058_89d678f2be164786b292527658ca1605 -O /opt/java/jre.tar.gz; else sudo wget https://javadl.oracle.com/webapps/download/AutoDL?BundleId=244056_89d678f2be164786b292527658ca1605 -O /opt/java/jre.tar.gz; fi; cd /opt/java; sudo tar -xvf jre.tar.gz; sudo mv ./jre1* ./jre; sudo rm -f ./jre*.tar.gz
You don’t have to type such long command in the terminal: after you select and copy the command above, click on the terminal window and then use the key combination Ctrl Shift V to paste it into the terminal. Confirm with Enter (a.k.a. Return) and then run this second command:
sudo update-alternatives --install /usr/bin/java java /opt/java/jre/bin/java 10; sudo update-alternatives --set java /opt/java/jre/bin/java
The first command will automatically:
- Create the folder
/opt/java/
- Check if your Linux distribution’s architecture is either 32 or 64 bits
- Download the corresponding JRE tarball file (i.e.
jre-8u281-linux-x64.tar.gz
if your system is a 64-bit one) - Decompress the tarball file into
/opt/java/
(a folder such as e.g.jre-8u281-linux-x64
will then be created in/opt/java/
and such JRE will therefore be placed under/opt/java/jre-8u281-linux-x64/
) - Rename the JRE’s folder to just
jre
(i.e./opt/java/jre-8u281-linux-x64/
will become/opt/java/jre/
) so it’s easier to set the default name of the system-wide JRE folder (the JVM will be located inside of such JRE’s folder) - Delete the tarball file (because at this point it won’t be useful/required anymore)
The second command will automatically:
- Add
/opt/java/jre/bin/java
to the system’s list of available JVMs (Java Virtual Machines). The JVM is the main component of the JRE - Set
/opt/java/jre/bin/java
as the default (system-wide) JVM
If both commands finish without errors, then you now have Oracle’s proprietary JRE installed and its corresponding JVM is set as system default. You may verify this by running this command:
java -version
…which will then output something like this:
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)