Apparently there are some performance improvements with Sun JRE 7 for minecraft. Since there isn’t an Ubuntu package for it, what’s the best way to cleanly run Minecraft within JRE 1.7? Two possibilities.
If you want an isolated installation of JRE 1.7 just for Minecraft without affecting Java on your system at large, here’s how:
- Create a Minecraft directory and put the Minecraft jar there.
- Grab the 32 bit version of 1.7 (must be 32bit version – even if you’re on adm64).
- Untar/gzip it in the Minecraft directory. (cd minecraft; tar -zxvf jre-7-ea-bin-bXXX-linux-i586-XX_XXX_XXXX.tar.gz)
- Create a little shell script to launch – see below (note we made our Minecraft directory in the home directory in this example).
#!/bin/sh MINECRAFT_DIR=$HOME/minecraft export LD_LIBRARY_PATH=$MINECRAFT_DIR/jre1.7.0/lib/i386 $MINECRAFT_DIR/jre1.7.0/bin/java -jar $MINECRAFT_DIR/minecraft.jar
If you think you might want to use 1.7 for other things and want it installed on your system at large, or you’d like to make use of Ubuntu’s “alternatives” functionality – do this:
- Create a Minecraft directory and put the Minecraft jar there.
- Grab the 32 bit version of 1.7 (must be 32bit version – even if you’re on adm64).
- Untar/gzip it. (cd minecraft; tar -zxvf jre-7-ea-bin-bXXX-linux-i586-XX_XXX_XXXX.tar.gz)
- Move it to ‘/usr/lib/jvm/’. (sudo mv jre1.7.0 /usr/lib/jvm)
- Add a new “alternative” for java. (sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 3)
- Choose that new alternative – select it from the list produced. (sudo update-alternatives –config java)
- Create a little shell script to launch – see below (note we made our Minecraft directory in the home directory in this example).
#!/bin/sh MINECRAFT_DIR=$HOME/minecraft export LD_LIBRARY_PATH=/usr/lib/jvm/jre1.7.0/lib/i386 java -jar $MINECRAFT_DIR/minecraft.jar
Bumped into this thing and apparently the amd64 version works perfectly now~
Cool – thanks for the heads up!
Hi, I just found this. I don’t know if it’s outdated now or anything, but …
How do you use a shell script? From Google, I got the idea that I should save it as an .sh file, but then I don’t know how to use it…
Update: I found out how to use the bash command, but it gives me two of the following errors:
– That on line 3, there is an unknown command
– and that jre1.7.0/bin/java does not exist (but it does)
It will still work fine. Which method did you use, the first of the second? Can you post the contents of the .sh file you created?
I created a file called “mine.sh” on my Desktop. I execute it by changing the directory to the Desktop and using “sudo bash mine.sh” Here is what the sh file has:
#!/bin/sh
MINECRAFT_DIR=$HOME/minecraft
export LD_LIBRARY_PATH=$MINECRAFT_DIR/jre/lib/i386
$MINECRAFT_DIR/jre/bin/java -jar $MINECRAFT_DIR/minecraft.jar
So that’s that. I have a folder in my main user directory called “minecraft,” and inside of it is the java file which I renamed “jre” for convenience. Also, the minecraft.jar is in the folder as well, of course. I’m using the 32-bit version as recommended, despite having a 64-bit processor.
Ok – the issue is most likely that you’re running your script with “sudo”. This runs the script as “root” instead of as your regular user. When you’re running it as root, the $HOME directory variable is no longer pointing to your home directory. Here’s how you should run it:
Make the script executable: Open a shell, change to the folder where your “mine.sh” script is and type “chmod a+x mine.sh”. This will set it to executable. Now you can run it directly, several ways:
* If you’re in a shell, in the same directory as your script – you can type “./mine.sh”.
* If you’re in a shell, in a different directory, you can run it by typing it’s full path – “/home/[YOUR USERNAME]/Desktop/mine.sh”.
* Since it’s on your desktop now, you can probably just double-click it and choose “run”.
If it’s still a no go, please post the output you’re getting and check the following:
1. Drop to a shell an do an “echo $HOME”, make sure that shows your home directory. It should be “/home/[YOUR USERNAME]”
2. Next, do “ls $HOME/minecraft” this should be your minecraft directory and it should list the contents including the minecraft jar file and the “jre” directory you put in there.
Also – this same basic process will work fine for running the latest snapshot version of the 64bit JRE (now that it works). Let me know how it goes!
Thank you for all the swift responses. I really appreciate it. Anyways, unfortunately, this is what I got now:
(:6334): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.so: wrong ELF class: ELFCLASS64
(:6334): Gtk-WARNING **: Loading IM context type ‘ibus’ failed
/usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so: wrong ELF class: ELFCLASS64
(:6334): Gtk-WARNING **: Failed to load type module: /usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so
/usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so: wrong ELF class: ELFCLASS64
(:6334): Gtk-WARNING **: Failed to load type module: /usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so
(:6334): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.so: wrong ELF class: ELFCLASS64
(:6334): Gtk-WARNING **: Loading IM context type ‘ibus’ failed
(:6334): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.so: wrong ELF class: ELFCLASS64
(:6334): Gtk-WARNING **: Loading IM context type ‘ibus’ failed
UPDATE: After it sent that and 3 minutes past, Minecraft just randomly opened. Should I assume this is just how it works, or are the GTK warnings evidence of something I should address?
Well, it looks like we’re getting closer! I think the errors you’re receiving may be due to an out of date “ia32-libs” package on your system (or the lack of it all together). This is a package that provides some auxiliary libraries related to running 32 bit apps on your 64 bit OS. Please do a “sudo dpkg -l ia32-libs” at the command line to make sure you have it. Then do a “sudo apt-get install ia32-libs”. This will install it if you don’t have it and if you do have it – it will upgrade it to the latest version.
As an alternative, you could download and use the latest 64bit snapshot of Java 7 (which I’m told now also works with Minecraft).
I have things up and working with Java7 on Mint 11 64bit. I did add a java.conf file to
/etc/ld.so.conf.d
with
/usr/lib/jvm/jdk1.7.0/jre/lib/amd64
then ran
sudo ldconfig
lets you skip the
export LD_LIBRARY_PATH=/usr/lib/jvm/jre1.7.0/lib/i386
And you can then play in the web browser
Works perfect with amd64 and Oracle Java 7!
Thanks!
Glad to hear it – have fun!!