Minecraft 1.8.2 – ArrayIndexOutOfBoundsException at LinuxDisplay.getAvailableDisplayModes()

I tried to play minecraft 1.8.2 this evening, only to have it crash on every startup with :

Time: 19/02/15 18:58
Description: Initializing game

        at avf.a(SourceFile:310)
        at net.minecraft.client.main.Main.main(SourceFile:124)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(
        at org.lwjgl.opengl.LinuxDisplay.init(
        at org.lwjgl.opengl.Display.(
        ... 4 more

The cause seems to be the move from lwjgl 2.9.1 to 2.9.4 with Minecraft 1.8.2.

After a lot of debugging and swearing from me, Steve found out that it was an issue with my dual monitors. Installing xrandr fixes lwjgl and then allows minecraft to start.

The issue comes from this line in the XRandR class which doesnt throw any exception when the command isnt available.  Parsing command line output from a child process in Java is really a bad idea.


* Utility for working with the xrandr commmand-line utility. Assumes
* xrandr v1.2 or higher.

9 Responses to “Minecraft 1.8.2 – ArrayIndexOutOfBoundsException at LinuxDisplay.getAvailableDisplayModes()”

  1. eloy paris Says:

    Thank you so much for this! Minecraft was working fine on our home Linux machines until a few days ago. My son tried to launch Minecraft today and it kept crashing with the same Java trace you show in this blog post. Installing the xorg-xrandr package (the machine where this was happening runs ArchLinux) fixed the problem. This is a laptop and I have no extra monitors, though.

    The Java crash trace and the error messages are pretty obscure, in my opinion, so I think I got lucky that I found your blog post and the hint to install xrandr.

    Thanks again!

  2. Angelux Says:

    Thanks for the info, it let me play Minecraft again 🙂

  3. Adam Says:

    I’m having this problem now with minecraft 1.8.3 (tried both Java 7 and Java 8). I’ve checked that the xrandr command works. Any other ideas? Thanks.

  4. Adam Says:

    I’ve cooked up a hack for this:

    Basically, my xrandr was showing two “connected” displays (my VGA port shows up, even when there isn’t anything physically connected to it) and that must have been giving lwjgl trouble. I wrote a script named ‘xrandr’ to filter (so to speak) the output of the real xrandr command, then modified my Minecraft launch script to juggle the path so the Minecraft JVM picks up the filtered command instead of the real one.

  5. Alexander Says:

    Sir, thank you very much!

    I am on Gentoo, and I haven’t had installed xrandr. After a recent update I got a.m. crash report, and was already getting mad when I eventually found this post!

    Now, I am sane again and can play Minecraft w/o probs. 🙂


  6. Brian Says:

    Thank you so much for this!

    It seems to happen with any java application using Lwjgl on an xorg-server while using more than one monitor without xrandr.

  7. Emanuel Says:


    This really had me stumped! Installing xorg-xrandr in Arch solved my problem

  8. Daniel Says:

    I already have xrandr installed, but it still does not work, what should I do?

  9. Neil Wightman Says:

    You can try running
    type xrandr
    which xrandr
    to check that xrandr command is in your PATH.

    If you run xrandr from a shell does it work correctly? I.e. show you screen resolutions, if not you may need to reinstall it.

Leave a Reply