Can Minecraft version 1.12 be run under Ubuntu 20.04?

Yes, Minecraft 1.12.2 can run well on Ubuntu 20.04, but it does require Java 8, usually listed as "1.8".

This answer thoroughly answers how to install Minecraft 1.12.2, server and client, on Ubuntu 20.04, or Mac OS, and how to install Forge as well, if you're going to want to mod it.

There are some excellent Minecraft Java Edition mods such as Serene Seasons and Dynamic Trees which provide motivation to run Minecraft Java Edition 1.12.2. Minecraft Bedrock users will find it's well worth buying a new set of Minecraft licenses for Java Edition, in order to experience amazing mods like Ice and Fire and the great variety of choices.

For those that don't know, this only applies to Minecraft Java Edition. Minecraft Bedrock is not mod-able, and to mod Minecraft Java Edition the great Minecraft Forge is also needed. If you only have Minecraft Bedrock, now is the time to re-purchase all your licenses for Java Edition. It's worth it.

I found using Java 8 from scratch for all steps worked with Mac OSX Minecraft server and Ubuntu 20.04 and Windows 10 clients.

For Minecraft Forge 1.12.2, when installing Minecraft server, Minecraft client, and Forge, Java 8 needs to be the system default Java. Multiple Java versions can be run reliably and simultaneously. It's probably easier to run simultaneous versions than uninstalling existing (probably later) Java, which might break something if that's done, anyway.

Also, Minecraft Java Edition needs to be installed first, and run at least once, before attempting the install of Forge, for server and clients. The Forge installer jar needs to be used, not the "universal" jar.

The following instructions detail how to find, install and select Java 8 as default, and install Minecraft Java Edition 1.12.2, and Forge 1.12.2, for Linux, Mac OSX and Windows.

You will need to be able to follow along with CLI bash commands, use sudo when necessary, and understand some basics about your user home directory and Minecraft install directory for your OS. There's plenty of support on-line if you need to search these aspects up. It may be helpful to reboot the machine after some steps; try it if the process seems blocked.

  • For the basics of installing Minecraft server refer to https://minecraft.fandom.com/wiki/Tutorials/Setting_up_a_server
  • For MacOS these instructions use HomeBrew, so that will need to be installed: https://www.dev2qa.com/how-to-install-homebrew-on-mac-os

1: Take the existing Minecraft offline (possibly 1.16.5 or so, who knows?)

To save the existing installation worlds for restoration later, move the Minecraft installation folder to some neutral location, such as a user home directory, or Documents, etc. The folder being used may be ~/.minecraft, /Library/Application Support/... or in the "roaming directory", for somewhere else. Use drag and drop or do something like mv ~/.minecraft ~/Documents/minecraft-1.16.5.

2: Install Java 8 on Linux

Comprehensive instructions for finding and installing Java are available: https://petewan.com/blog-post/install-and-manage-multiple-java-jdk-and-jre-versions-on-ubuntu-20-04/

Check what version of Java is installed already, for example:

java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

Install Open JDK Java 8:

sudo apt update
sudo apt install openjdk-8-jdk

I didn't use Oracle Java but I thought I would refer to it here in case others need it:

# sudo add-apt-repository ppa:webupd8team/java
# sudo apt install oracle-java8-installer
# sudo apt install oracle-java8-set-default

2: Install Java 8 on Mac OSX

Comprehensive instructions for finding and installing Java are available: https://www.dev2qa.com/how-to-install-uninstall-multiple-java-versions-in-mac-os-by-home-brew-or-manually/

Ensure HomeBrew has cask installed:

brew tap homebrew/cask-versions

Use HomeBrew search to discover the names of the Java versions available for installation:

brew search java
brew search jdk

These commands will list helpful names of available HomeBrew installations such as adoptopenjdk8.

  • The brew search command will list "Formulae" and "Casks".
  • Java 8 is likely available only in Casks.
  • Identify a name from the lists that includes "java" or "jdk" followed by "8".

The brew cask command is no longer available, but brew install --cask is, so use that command with the name chosen from the brew search list:

brew install --cask adoptopenjdk8

This command may likely throw an error but will hopefully list other "locations":

Error: Cask adoptopenjdk8 exists in multiple taps:
homebrew/cask-versions/adoptopenjdk8
caskroom/versions/adoptopenjdk8

Therefore re-try the install using the full path listed, which should be something like one of these:

brew install --cask adoptopenjdk8/openjdk/adoptopenjdk8
brew install --cask homebrew/cask-versions/adoptopenjdk8

2: Install Java 8 on Windows

If using a Windows client, despite Java now being in release 16, I found Java 8 is still the Java used on Windows 10. Nothing to install! Windows is so easy ;)

3: Establish Java 8 as system default on Linux

After installing Java 8 the previous Java is likely to still be the default. Check the alternatives available on the system. Java 8 lists as "1.8":

update-java-alternatives --list
java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64  1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64

Use update-alternatives to select Java 8 as the new default. A prompt will be offered to select a new default Java by pressing a number:

sudo update-alternatives --config java
sudo update-alternatives --config javac

If update-alternatives is not available update-java-alternatives --set might be useful.

This may be enough to set Java 8 as the default. In a fresh shell check the current Java version:

java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

If there are still problems reaching Java 8 it may help to set the JAVA_HOME environment variable. The canonical path to the current Java can be determined using readlink. Previously it may have returned something like this:

readlink -f /usr/bin/java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java

With Java 8 installed it should look more like this:

readlink -f /usr/bin/java
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

Chop off the /jre/bin/java or /bin/java segment to determine the Java home directory. Set that path as the JAVA_HOME environment variable in the shell profile of the user that will be running Minecraft:

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:jre/bin/java::")

That is to say (these two should be the same but this one is better):

export JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64'

Contrary to some guides, the JAVA_HOME variable does not reference the bin directory. But the bin directory should be referenced in the PATH variable, which could also be added if problems are still happening:

export PATH="$PATH:$JAVA_HOME/bin"

It shouldn't be necessary to use a /jre/bin/ suffix because /jre/bin should be symlinked to /bin as well.

Hopefully java -version will now return Java 8 as required.

3: Establish Java 8 as system default on Mac OSX

After installing Java 8, unless there were no other Javas present before, it will still probably not be the system default. To check which version is being used call Java with the version option in a fresh terminal:

java -version

It may list something like Java 11. Java 8 lists as "1.8".

To make Java 8 the system default the environment needs to be configured to report the correct JAVA_HOME and PATH variables.

Java 8 should now be listed among the known versions of Java as shown by running /usr/libexec/java_home:

/usr/libexec/java_home -V
Matching Java Virtual Machines (4):
15.0.2, x86_64: "AdoptOpenJDK 15"   /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home
1.8.0_292, x86_64:  "AdoptOpenJDK 8"    /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
1.6.0_65-b14-468, x86_64:   "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Now the JAVA_HOME environment variable needs to be set to the path listed for Java 8 (Java 1.8). Specify this in the bashrc / bash_profile / profile or Zsh profile for the user that is running the server, so that it is set every time the user logs in / starts up. The java_home command can help with this:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_292)

or specify just the major version:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

When done, running a fresh terminal should result in the path to the Java Home directory in the JAVA_HOME variable:

echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

Then the PATH variable also needs to be set to include the particular JAVA_HOME bin directory. Again, in the shell profile, set the

PATH="$PATH:$JAVA_HOME/bin"
echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin

The current Java version in use should be visible as Java 8 (1.8) when running Java alone in a fresh terminal:

java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

3: Establish Java 8 as system default on Windows

As before, this should not be necessary, as Windows is still using Java 8.

4: Download, install and run Minecraft server

The official Minecraft server JAR for 1.12.2 is available here: https://www.minecraft.net/en-us/article/minecraft-1122-released Downloading from the link on that page should provide minecraft_server.1.12.2.jar. Run the JAR file to install it, using the newly installed Java 8:

java -jar minecraft_server.1.12.2.jar

This operation should be the same for Linux, Mac, and even Windows.

Remember, it will be necessary to run the Minecraft JAR twice. The first time it will generate some files and then drop out because the EULA is not signed. Edit eula.txt to read eula=true and then re-run to make sure Minecraft Java Edition server runs.

I've read that Minecraft server is not necessary when running Forge as a server, since Forge handles everything. However, this is the route I took and it worked for me.

5: Download and install the Minecraft Launcher

There are two executables involved in running Minecraft as a client: the Launcher and the game. This is important because the game needs to be installed before Forge is installed, and only playing the game will trigger download and install of that version of the game from the Launcher.

The official Minecraft Launcher is available here: https://www.minecraft.net/en-us/download The page has links for a Mac DMG installer, and a Windows MSI installer. Of course, it can also be downloaded directly from the command line on Linux:

wget -o ~/Minecraft.deb https://launcher.mojang.com/download/Minecraft.deb

Install the Launcher as normal for Mac and Windows. For Ubuntu Linux this will work for installing a DEB package:

sudo dpkg -i Minecraft.deb

And list where the Launcher has installed:

ls /var/lib/dpkg/info/minecraft-launcher.*
dpkg -L minecraft-launcher
/usr/bin/minecraft-launcher
/usr/share/applications/minecraft-launcher.desktop
/usr/share/icons/hicolor/symbolic/apps/minecraft-launcher.svg
...
sudo apt list --installed | grep craft
minecraft-launcher/now 928 amd64 [installed,local]

When downloading the game in the Launcher be patient. Microsoft is only a small company with few resources and it may take some time, and even one or more re-tries, to download the game from their server. It may also be necessary to re-boot afterwards.

6: Play latest Minecraft!

When Minecraft Launcher is first installed there are no Minecraft games available on the system. I found that playing latest Minecraft single player was a necessary step in order to unlock the previous versions in the Minecraft Launcher Installations. So play Minecraft single player!

The Launcher should offer a play button, and clicking it will download, install and run the latest Minecraft Java Edition game, now within Java 8. This should be the same on Linux, Mac and Windows.

7: Install and play Minecraft 1.12.2 client

Again, on Linux, Mac and Windows the same process should be possible. After playing latest Minecraft from the Launcher, apart from installing the latest Minecraft client, the Launcher should now offer previous versions of the Minecraft game client.

(Apparently Minecraft server installer can be downloaded from here as well, but I didn't try it.)

For Windows it may be necessary to use Settings > General > Show historical versions of Minecraft Java Edition in the Launcher to unlock the previous versions.

  • Run the Minecraft Launcher but do not play a game
  • Change to the "Installations" tab in the Launcher
  • Click on "New Installation" and select 1.12.2 in the versions menu
  • Save this new installation and select it to play Minecraft 1.12.2

Now play vanilla Minecraft again from the Launcher - this time version 1.12.2. This action will download and install Minecraft 1.12.2 on the client machine.

At this point old-fashioned vanilla Minecraft Java Edition 1.12.2 is available as game clients and server. I guess it's worth checking this works by attempting a 1.12.2 vanilla network game to the server.

8: Install and run Forge 1.12.2 for client and server

It's now time for Forge.

The Forge 1.12.2 installer is available on the official web site. Make sure to click on the "Installer" icon. "Universal" or some such won't work: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.12.2.html

This operation is not totally trivial. Avoid all links after redirect, and wait for the "skip" button to appear top-right. I won't detail click-by-click instructions here, but they are available: https://www.alphr.com/install-minecraft-forge-windows-mac/

  • For each client and server place the downloaded Forge installer JAR in the Minecraft directory (this may not be necessary but that's what I did).
  • The java -version call should confirm the default Java is Java 8.
  • On Linux run a precautionary sudo apt update and sudo apt upgrade before proceeding.
  • Run the Forge JAR file (on Windows double-clicking it should be sufficient): java -jar forge-1.12.2-14.23.5.2855-installer.jar
  • When the GUI pops up select "Install client" or "Install server" as appropriate for that machine.

After installation there should be a new Forge JAR file that is not named "installer":

forge-1.12.2-14.23.5.2855-installer.jar
forge-1.12.2-14.23.5.2855-installer.jar.log
forge-1.12.2-14.23.5.2855.jar

For Minecraft server it should now be possible to run the new Forge JAR. This is the short script I use to start our family Minecraft Forge on Mac OS, setting the environment variables as well, as a precaution:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export PATH="$PATH:$JAVA_HOME/bin"
cd /Users/family/Minecraft
exec java -Xms512M -Xmx2048M -XX:+UseG1GC -jar forge-1.12.2-14.23.5.2855.jar nogui

For the client, after starting Minecraft Launcher, use the "Installations" tab again. Create a new installation and find the new Forge 1.12.2 entry in the menu to select for a release.

Playing Minecraft from this installation should now be sufficient to find and access the Forge 1.12.2 server.

Just drop the same mod JAR files in the server and client "mods" directories to quadruple, quintuple, and decuple the value you get from the game!