Minecraft on a NetBSD Desktop

Note: This tutorial assumes you have basic knowledge of how to use pkgsrc, and have it and a full base system of NetBSD installed.  If you don’t know how to use pkgsrc, read up more here.

Minecraft is written in Java, so porting it across systems is a non issue, right?  That is mostly true — except that the LWJGL library it makes use of is platform dependent. Trying to boot up minecraft on NetBSD using the standard OpenJDK that ships with pkgin/pkgsrc results in this tidy error:

Exception in thread "main" java.lang.LinkageError: Unknown platform: NetBSD
at org.lwjgl.LWJGLUtil.<clinit>(LWJGLUtil.java:280)
at org.lwjgl.Sys.createImplementation(Sys.java:124)
at org.lwjgl.Sys.<clinit>(Sys.java:111)
at net.minecraft.client.Minecraft.G(SourceFile:1985)
at net.minecraft.client.Minecraft.main(SourceFile:1559)

The solution to this is to use NetBSD’s Linux emulation to run LWJGL, which is done by using Oracle’s Linux JRE rather than pkgsrc’s OpenJDK. This method was tested and working on NetBSD 7 + pkgsrc stable/Q2_2016, but should work on any recent NetBSD release. If you need a different Oracle binary, pkgsrc will tell you which you need; just run ‘make’ and it will spit it out when it fails:

  1. Download the Oracle JRE Binaries:
    cd /usr/pkgsrc/distfiles
    wget http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/jre-8u92-linux-x64.tar.gz
    # OR to get it from oracle direct; uses cookies to accept licence
    curl -L -k -b "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jre-8u92-linux-x64.tar.gz > jre-8u92-linux-x64.tar.gz
  2. Accept the Oracle Licence:
    echo "ACCEPTABLE_LICENSES+= oracle-binary-code-license" >> /etc/mk.conf
  3. Build and install oracle8-jre
    cd /usr/pkgsrc/lang/oracle8-jre
    make && make install
  4. Enable Linux Emulation layer
    echo "procfs /emul/linux/proc procfs rw,linux" >> /etc/fstab
    mount /emul/linux/proc
  5. Download Linux version of minecraft, and run!
    oracle8-jre /path/to/minecraft.jar

And there you have it:

Minecraft + NetBSD: With the Linux emulation layer, you can run Minecraft. Performance here is only poor because the desktop is ~6 or so years old.

One interesting thing to note is that this doesn’t just apply to amd64 archetecture; if you have an x86 (32 bit) processor, you can substitute Oracle’s i586-compiled JRE and Linux emulation will still work.  Taking that one step further, if you run sparc or sparc64 processors, you can use NetBSD Solaris emulation, and run LWJGL Solaris-compiled binaries with the Oracle sparc/sparc64 JRE!

Leave a Reply

Your email address will not be published. Required fields are marked *