Author: Pierre Guinoiseau == How to get Minecraft running natively on FreeBSD == = Some explanations before we start = Minecraft is shipped with 2 java libs : JUtils and LWJGL, and both of them use native libraries, which can't be loaded on FreeBSD. We have to recompile it. Only LWJGL is mandatory, for 3D and sound support. JInput is only usefull for some additional input support on Linux, Windows and MacOSX, it does not provide it for FreeBSD or any other OS, so we can simply delete it. LWJGL will complain a lille on loading, but still run just fine. However, it's still needed for building, and JInput needs JUtils also. Along this HOWTO, I'll assume we are working in a ~/work/ directory and that we are on an amd64 architecture. I can't test it on another one. = Preliminaries = You will need OpenJDK 6 (OpenJDK 7 may work too, but I did not test it), openal, apache-ant, and subversion to get the JUtils and JInput sources. You can install it from ports as usual: java/openjdk6 devel/apache-ant devel/subversion (or devel/subversion-freebsd) audio/openal-soft = JUtils = This one is pretty easy, juste grab the sources from SVN,build it and you're done. I suggest you fetch it at revision 26. Last revisions don't build anymore with ant, but with maven instead, and I don't know how to use it. ~/work % svn checkout -r 26 https://svn.java.net/svn/jutils~svn/trunk jutils ~/work % cd jutils ~/work/jutils % ant jutils.jar is located at bin/jutils.jar. = JInput = Easy too if we don't bother with the natives libs part, which are not useful for us. grab the sources from SVN, add our previous jutils.jar in lib/, build it, and you're done. ~/work % svn checkout https://svn.java.net/svn/jinput~svn/trunk jinput ~/work % cd jinput ~/work/jinput % ln -s ../../jutils/bin/jutils.jar lib/ ~/work/jinput % ant simple_linux jinput.jar is located at dist/jinput.jar. = LWJGL = LWJGL is a bit more tricky, we have to patch it so that native libs are compiled as if we were on Linux, and some MacOSX parts need to be commented out (Debian does it too). We don't need SVN here, LWJGL has regular releases, we'll use the 2.7.1 version, Minecraft runs fine with it. ~/work % fetch http://downloads.sourceforge.net/project/java-game-lib/Official%20Releases/LWJGL%202.7.1/lwjgl-source-2.7.1.zip ~/work % mkdir lwjgl ~/work % unzip -d lwjgl lwjgl-source-2.7.1.zip ~/work % cd lwjgl ~/work/lwjgl % fetch http://foo.poildetroll.net/minecraft/lwjgl-2.7.1-freebsd.diff ~/work/lwjgl % patch -p1 < lwjgl-2.7.1-freebsd.diff ~/work/lwjgl % export CLASSPATH=~/work/jutils/bin/jutils.jar:~/work/jinput/dist/jinput.jar ~/work/lwjgl % ant jars ~/work/lwjgl % ant compile_native Our libs are in libs/ and libs/linux: lwjgl.jar lwjgl_util.jar linux/liblwjgl64.so And now you're done building it! = Running Minecraft with our fresh libs = First, if you don't have a ~/.minecraft/ directory yet, with the original .jar in it, you have to launch Minecraft one first time, it'll download it and set it up. Some things to know for running Minecraft on FreeBSD: - Minecraft does some sort of switch() on startup to determine which paths and libs to use depending on your OS, but it doesn't know FreeBSD and ends up with a NULLPointerException. So we have to make it believe we are on Linux by using -Dos.name=Linux. - There is a bug with OpenJDK on FreeBSD and the IPv6 stack, which will make Minecraft fail with networking, so we have to force IPv4 with -Djava.net.preferIPv4Stack=true. There we go, download the Minecraft Launcher from minecraft.net and run it: ~ % fetch http://www.minecraft.net/download/minecraft.jar ~ % java -Dos.name=Linux -Xmx1024M -Xms512M -Djava.net.preferIPv4Stack=true -cp minecraft.jar net.minecraft.LauncherFrame Let it download its binaries and all, and then it will eventually fail at loading it, this is normal. Kill it for now. Now that you have your ~/.minecraft/ directory, go in ~/.minecraft/bin/ and replace the libs with your fresh ones. As said at the beginning, you can remove all jinput libs, it'll still run fine without it. ~ % cd ~/.minecraft/bin ~/.minecraft/bin % rm lwjgl.jar jinput.jar lwjgl_util.jar linux_natives.jar.lzma natives/* ~/.minecraft/bin % cp ~/work/lwjgl/libs/{lwjgl.jar,lwjgl_util.jar} . ~/.minecraft/bin % cp ~/work/lwjgl/libs/linux/liblwjgl64.so natives/ And that's all! Now you can run the launcher again as said before and enjoy Minecraft on FreeBSD! ~ % java -Dos.name=Linux -Xmx1024M -Xms512M -Djava.net.preferIPv4Stack=true -cp minecraft.jar net.minecraft.LauncherFrame Enjoy and have fun!