Minecraft seems to be everywhere and one of the nice things about it is that it will run quite happily on Linux (actually there are some things like manipulating ‘.jar’ files that are probably easier on Linux), and if you are a thinking of trying out Linux but are put off by not being able run Minecraft then the good news is that getting it too work on Linux isn’t hard – but occasionally something unexpected happens as it did to me recently.
I’d was just finishing off a new install of Debian 8.0 (jessie) and checking to see if everything still worked when I found that the current version of Minecraft crashed when launching the game. It looks like the crash is also connected to the recent updates that have been made since release 1.8.1 as that version still worked – so if you are running Minecraft on Linux and are having problems after upgrading to a later version this may also fix your problem if you are getting the same error message.
: : java.lang.ExceptionInInitializerError at ave.ar(SourceFile:560) at ave.am(SourceFile:361) at ave.a(SourceFile:310) at net.minecraft.client.main.Main.main(SourceFile:124) Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes (LinuxDisplay.java:951) at org.lwjgl.opengl.LinuxDisplay.init (LinuxDisplay.java:738) at org.lwjgl.opengl.Display. (Display.java:138) ... 4 more : : : Launched Version: 1.8.5 LWJGL: 2.9.4 OpenGL: RuntimeException: No OpenGL context found in the current thread. GL Caps: : :
Note – I’ve inserted some line breaks in the text above so it is readable without having to scroll horizontally.
It looks like the program is trying to initialize the display and fails when it attempts to get the available display modes. Minecraft has worked previously on this system with the same version of the nVidia driver so it was unlikely to be a driver problem and since I had just re-installed Linux from scratch using only the minimum number of required packages I was reasonably sure that this problem was being caused by a missing utility from a package that I’d not installed. The question was which one?
For no particular reason (other then that I use a rather old KVM switch that requires my display settings to be tweaked a bit to work properly) I decided to check to see what X windows thought the current display mode was in case that was causing problems – and for once I got lucky.
$ xrandr bash: xrandr: command not found
Oops – that isn’t supposed to happen…
To fix the problem I decided to install the missing package – but which package contains ‘xrandr’?
Fortunately there is an easy way to find out – just paste the following URL into your browser’s address bar to return a list of all packages containing a filename ending in ‘xrandr’
File Packages /usr/bin/lxrandr lxrandr /usr/bin/unxrandr arandr /usr/bin/xrandr x11-xserver-utils /usr/lib/xbmc/xbmc-xrandr xbmc-bin /usr/share/menu/lxrandr lxrandr
So the missing package that contains 'xrandr' is 'x11-xserver-utils', which I can install using 'apt-get'.
$ su Password: # apt-get install x11-xserver-utils Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: nickle cairo-5c xorg-docs-core The following NEW packages will be installed: x11-xserver-utils 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 158 kB of archives. : : : Setting up x11-xserver-utils (7.7+3+b1) ... # exit $
Now I don't know exactly why this fixes the problem but it looks like after version 1.8.1 Minecraft may be using 'xrandr' to get the available display modes, since after I'd installed it not only was I able to see my current display modes but Minecraft also started working again.
$ xrandr Screen 0: minimum 8 x 8, current 1920 x 1200, maximum 16384 x 16384 VGA-0 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 540mm x 350mm 1920x1200 59.95 + 59.88* 1920x1080 60.00 1680x1050 59.95 1600x1200 60.00 1600x1000 60.00 1280x1024 75.02 60.02 1280x960 60.00 1024x768 75.03 60.00 800x600 75.00 60.32 640x480 75.00 59.94 DVI-D-0 disconnected (normal left inverted right x axis y axis) HDMI-0 disconnected (normal left inverted right x axis y axis) DVI-D-1 disconnected (normal left inverted right x axis y axis)
Phew - That should keep someone quiet for a bit...