sakana

very short memo

how to play minecraft on ubuntu

My daughter would like to play her favorite game, minecraft on her ubuntu box. Here is a short memo to summarize procedure to setup environment to play minecraft on ubuntu.

JVM

minecraft client is a jar file and you would better to have hotspot VM. You can install hotpost VM as follows:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

search path

As with default configuration shared object libjawt.so can not be found. You have to configure environment variable LD_LIBRARY_PATH so that libjawt.so can be searched for.

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/java-7-oracle/jre/lib/i386/

key input

As ibus interrupts key input on minecraft and You can not input any word on minecraft. You can avoid this problem by configuring following environment variable:

XMODIFIERS=@im=none

script

Here is sample script to launch minecraft. If you would like to speak something upon start-up, please install TTS engine, festival.

#!/usr/bin/env bash

LANG=C
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/java-7-oracle/jre/lib/i386/
XMODIFIERS=@im=none
export LANG LD_LIBRARY_PATH XMODIFIERS

MINE_HOME=~/minecraft
cd $MINE_HOME

START_MSG="start minecraft"
echo $START_MSG|festival --tts

LOG=play.`date "+%Y%m%d"`.log

echo "START: " `date` >> $LOG
java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame >> $LOG 2>&1
echo "FINISH: " `date` >> $LOG

register unity panel

You can launch above script directly from unity panel.

  • desktop file

Create desktop configuration file (e.g. minecraft.desktop) so that unity can evaluate how to launch application.

[Desktop Entry]
Type=Application
Terminal=false
Name=minecraft
Icon=/PATH_TO_ICON_DIR/minecraft.ico
Exec=/PATH_TO_SCRIPT_DIR/minecraft.sh

Put this desktop configuration file under /usr/share/applications directory.

  • unity panel

And drag & drop this desktop configuration file onto unity panel.