# games/minecraft-client update to minecraft 1.7



## dominik (Nov 2, 2013)

Hey FreeBSD guys,

I'm hardly trying getting the 1.7.x version of the Minecraft client to work. The games/minecraft-client port currently uses the deprecated 1.4.x branch which can't be used on most servers any longer. So I think we should update the port after we develop a working configuration.

As mentioned in Thread 40669 it should be possible to get it to run again 

I made some small changes in the Makefile and updated the SHA256 checksum of the Minecraft.jar for v1.7. The launcher starts, but I still get this error before starting the game:


```
[11:09:00 INFO]: Job 'Version & Libraries' finished successfully
[11:09:00 INFO]: Launching game
[11:09:00 INFO]: Looking for old natives to clean up...
[11:09:00 INFO]: Unpacking natives to /home/dominik/.minecraft/versions/1.7.2/1.7.2-natives-2377923742155
[11:09:00 INFO]: Launching in /home/dominik/.minecraft
[11:09:02 INFO]: Client> Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/home/dominik/.minecraft/versions/1.7.2/1.7.2-natives-2377923742155/liblwjgl.so: /usr/home/dominik/.minecraft/versions/1.7.2/1.7.2-natives-2377923742155/liblwjgl.so: unsupported file layout (Possible cause: architecture word width mismatch)
[11:09:02 INFO]: Client> 	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
[11:09:02 INFO]: Client> 	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
[11:09:02 INFO]: Client> 	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1675)
[11:09:02 INFO]: Client> 	at java.lang.Runtime.loadLibrary0(Runtime.java:840)
[11:09:02 INFO]: Client> 	at java.lang.System.loadLibrary(System.java:1047)
[11:09:02 INFO]: Client> 	at org.lwjgl.Sys$1.run(Sys.java:73)
[11:09:02 INFO]: Client> 	at java.security.AccessController.doPrivileged(Native Method)
[11:09:02 INFO]: Client> 	at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
[11:09:02 INFO]: Client> 	at org.lwjgl.Sys.loadLibrary(Sys.java:95)
[11:09:02 INFO]: Client> 	at org.lwjgl.Sys.<clinit>(Sys.java:112)
[11:09:02 INFO]: Client> 	at azd.J(SourceFile:2064)
[11:09:02 INFO]: Client> 	at net.minecraft.client.main.Main.main(SourceFile:36)
[11:09:02 ERROR]: java.io.IOException: Stream closed
[11:09:02 ERROR]: java.io.IOException: Stream closed
```

Does anyone know what's going wrong there?


----------



## amracks (Dec 17, 2013)

The 1.7.4 launcher gets in the way a little bit, if you watch the console output, or the log in the launcher when you try to run, it will give you the full Java command that it attempts to run. You can run that command directly with a few modifications.  You have to install games/lwjgl for this to work.

Change the java.library.path to be the path to your native lwjgl library (-Djava.library.path=/usr/local/lib/lwjgl2.9.0)
Change the CLASSPATH to reference the lwjgl.jar and lwjgl_util.jar installed by the port instead of the jars that the Minecraft launcher provides. (`pkg_info -LX lwjgl` to see where they are)
You could have to do this within a certain amount of time of running the launcher because there is some accessToken that is appended to the Java command line.

I'm considering wrapping the Java executable with a script that makes these modifications on the fly, the launcher lets you set the Java command you want to run, you could potentially set this to the wrapper that overrides the lwjgl references in the java.library.path and CLASSPATH.


----------



## amracks (Dec 17, 2013)

I couldn't help myself, save the script somewhere, make it executable. you need bash, openjdk6 and lwjgl.  If you want to use openjdk7, change the JAVA_HOME*.*

Run the Minecraft jar: `java -jar Minecraft.jar`.
Edit Profile.
Check the "Executable" checkbox under "Java Settings (Advanced)" and put the path to the script.
Save Profile.
Push the "Play" button to play.

Maybe I'll make a port.

```
#!/usr/local/bin/bash

LWJGL_JLP_OVRD="/usr/local/lib/lwjgl2.9.0"
LWJGL_OVRD="/usr/local/share/java/classes/lwjgl/lwjgl.jar"
LWJGL_UTIL_OVRD="/usr/local/share/java/classes/lwjgl/lwjgl_util.jar"

export JAVA_HOME=/usr/local/openjdk6

build_classpath() {
    j=0
    ocp=`echo ${1} | sed 's/:/ /g'`
    for p in ${ocp}
    do
        if [[ $p == *lwjgl-* ]]
        then
            ncp[$j]=${LWJGL_OVRD}
        elif [[ $p == *lwjgl_util* ]]
        then
            ncp[$j]=${LWJGL_UTIL_OVRD}
        else
            ncp[$j]=${p}
        fi
        j=$(( j + 1 ))
    done

    cp=`echo ${ncp[@]} | sed 's/ /:/g'`
}


i=0
for var in "${@}"
do
    if [[ "$var" == -Djava.library* ]]
    then
        args[$i]="-Djava.library.path=${LWJGL_JLP_OVRD}"
    elif [[ "$var" == *lwjgl_util* ]]
    then
        build_classpath "${var}"
        args[$i]="$cp"
    else
        args[$i]=$var
    fi
        i=$(( i + 1 ))
done

${JAVA_HOME}/jre/bin/java ${args[@]}
```


----------



## chess (Jan 10, 2014)

@amracks, thank you! Your script works perfectly.


----------



## CanOfBees (Jan 17, 2014)

@amracks, ditto on the thanks!

I've run into a problem with sound, though: I'm not getting any. There's the following error in the console:

```
[20:42:42 INFO]: Client> Starting up SoundSystem...
[20:42:42 INFO]: Client> Initializing LWJGL OpenAL
[20:42:42 INFO]: Client>     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[20:42:42 INFO]: Client> Error in class 'LibraryLWJGLOpenAL'
[20:42:42 INFO]: Client>     Unable to initialize OpenAL.  Probable cause: OpenAL not supported.
[20:42:42 INFO]: Client>     ERROR MESSAGE:
[20:42:42 INFO]: Client>         Could not locate OpenAL library.
[20:42:42 INFO]: Client>     STACK TRACE:
[20:42:42 INFO]: Client>         org.lwjgl.openal.AL.create(AL.java:151)
[20:42:42 INFO]: Client>         org.lwjgl.openal.AL.create(AL.java:102)
[20:42:42 INFO]: Client>         org.lwjgl.openal.AL.create(AL.java:201)
[20:42:42 INFO]: Client>         paulscode.sound.libraries.LibraryLWJGLOpenAL.init(LibraryLWJGLOpenAL.java:164)
[20:42:42 INFO]: Client>         paulscode.sound.SoundSystem.CommandNewLibrary(SoundSystem.java:1576)
[20:42:42 INFO]: Client>         paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2572)
[20:42:42 INFO]: Client>         paulscode.sound.CommandThread.run(CommandThread.java:121)
[20:42:43 INFO]: Client>     ERROR MESSAGE:
[20:42:43 INFO]: Client>         Could not locate OpenAL library.
[20:42:43 INFO]: Client> 
[20:42:43 INFO]: Client> Starting up SoundSystem...
[20:42:43 INFO]: Client> [20:42:43] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[20:42:43 INFO]: Client> [20:42:43] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[20:42:43 INFO]: Client> Switching to No Sound
[20:42:43 INFO]: Client>     (Silent Mode)
[20:42:43 INFO]: Client> 
[20:42:43 INFO]: Client> [20:42:43] [Sound Library Loader/INFO]: Sound engine started
```

There seems to be some .jar downloading happening as the game starts up: 

```
[20:42:39 INFO]: Finished downloading /usr/home/bridger/minecraft/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar for job 'Version & Libraries': Local file matches local checksum, using that
[20:42:39 INFO]: Finished downloading /usr/home/bridger/minecraft/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar for job 'Version & Libraries': Local file matches local checksum, using that
[20:42:39 INFO]: Finished downloading /usr/home/bridger/minecraft/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar for job 'Version & Libraries': Local file matches local checksum, using that
```

But still no sound. I can get sound outside of Minecraft (e.g. Youtube, MP3s). I've looked through FreshPorts and I see a number of 'OpenAL' implementations but I'm not sure which one to try. Does anyone have any suggestions?

Thanks for your help, and thanks again for the script.


----------



## gferenc88 (Jan 22, 2014)

Hi,

you have to install the following port: audio/openal-soft.


----------



## CanOfBees (Jan 22, 2014)

Hi @gferenc88, 
thanks very much for that tip. audio/openal-soft is exactly what I was missing.

Cheers!


----------



## Monti (Aug 6, 2015)

Thanks a lot for the script amracks. I have tried the latest Minecraft Linux version 1.8.8 and despite an OS message in terminal it is starting up perfectly it seems. The message is:

```
[10:42:11 FATAL]: This operating system is unknown or unsupported, we cannot guarantee that the game will launch successfully.
```

There is one problem though. The game is not using the Nvidia drivers installed. From performance it looks like software rendering only. I do not know if this have something to do with the Linux mc version. OpenJDK version used is 7. lwjgl is 2.9.1. I have done a search and found a parameter to give Java and are wondering if this is something that could be used in the script to initialize  OpenGL? The parameter is:

```
-Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true
```

Thanks


----------



## Monti (Aug 9, 2015)

Ok. In case someone is reading my post just above. Please disregard what I wrote. When joining servers with small play rooms it is running quite well. So my conclusion is that it has something to do with memory handling.

Last, again thank you very much for the script amracks. It is doing its job very well.


----------



## graemeg (Jan 5, 2017)

amracks said:


> I couldn't help myself, save the script somewhere, make it executable. you need bash,...


*Thank you so much!* I've been struggling for a few days now trying to get the Minecraft client running under FreeBSD. I've managed to get it to run with Linux emulation, but then no sound. With your help I've managed to get it working natively under FreeBSD with sound and all. Many thanks for sharing your solution. I'm using FreeBSD 10.3, openjdk8 and NVidia gfx drivers (I compiled and installed games/lwjgl from ports).


----------

