Playing Minecraft on FreeBSD

2010-09-20 19:09

Minecraft is an addictive cross-platform sandbox game about punching trees. With java/jdk16 installed, I attempted to run Minecraft.jar, the game launcher, on my FreeBSD amd64 desktop.

java -version
  1. java version "1.6.0_03-p4"
  2. Java(TM) SE Runtime Environment (build 1.6.0_03-p4-nicole_17_aug_2010_02_15-b00)
  3. Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-p4-nicole_17_aug_2010_02_15-b00, mixed mode)

It runs and displays the login box. Attempting to log in, however, is disastrous:

Minecraft launcher showing a "Failed to launch" error

java -jar Minecraft.jar
  1. Username is 'okeeblow'
  2. java.lang.NullPointerException
  3. at net.minecraft.GameUpdater.fatalErrorOccured(GameUpdater.java:766)
  4. at net.minecraft.GameUpdater.loadJarURLs(GameUpdater.java:193)
  5. at net.minecraft.GameUpdater.run(GameUpdater.java:212)
  6. at net.minecraft.Launcher$1.run(Launcher.java:73)
  7. Fatal error occured (2): null
  8. java.lang.NullPointerException
  9. at net.minecraft.GameUpdater.fatalErrorOccured(GameUpdater.java:766)
  10. at net.minecraft.GameUpdater.loadJarURLs(GameUpdater.java:193)
  11. at net.minecraft.GameUpdater.run(GameUpdater.java:212)
  12. at net.minecraft.Launcher$1.run(Launcher.java:73)

I then tried java/openjdk6.

java -version
  1. openjdk version "1.6.0"
  2. OpenJDK Runtime Environment (build 1.6.0-b20)
  3. OpenJDK 64-Bit Server VM (build 17.0-b16, mixed mode)

A different error.

Minecraft launcher showing a "Can’t connect to minecraft.net" error.

java -jar Minecraft.jar
  1. java.net.SocketException: Invalid argument
  2. at java.net.PlainSocketImpl.socketConnect(Native Method)
  3. at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
  4. at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
  5. at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
  6. at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
  7. at java.net.Socket.connect(Socket.java:546)
  8. at java.net.Socket.connect(Socket.java:495)
  9. at sun.net.NetworkClient.doConnect(NetworkClient.java:178)
  10. at sun.net.www.http.HttpClient.openServer(HttpClient.java:409)
  11. at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
  12. at sun.net.www.http.HttpClient.New(HttpClient.java:321)
  13. at sun.net.www.http.HttpClient.New(HttpClient.java:338)
  14. at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:814)
  15. at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:755)
  16. at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:680)
  17. at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:858)
  18. at net.minecraft.Util.excutePost(Util.java:70)
  19. at net.minecraft.LauncherFrame.login(LauncherFrame.java:80)
  20. at net.minecraft.LoginForm$3.actionPerformed(LoginForm.java:61)
  21. at java.awt.Button.processActionEvent(Button.java:409)
  22. at java.awt.Button.processEvent(Button.java:377)
  23. at java.awt.Component.dispatchEventImpl(Component.java:4469)
  24. at java.awt.Component.dispatchEvent(Component.java:4295)
  25. at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
  26. at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
  27. at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
  28. at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
  29. at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
  30. at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
  31. at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

This one, however, isn’t Minecraft’s fault. It’s a known problem with OpenJDK on FreeBSD. Forcing OpenJDK to use IPv4 with -Djava.net.preferIPv4Stack=true then yields the same error as before.

java -Djava.net.preferIPv4Stack=true -jar Minecraft.jar
  1. Username is 'okeeblow'
  2. java.lang.NullPointerException
  3. at net.minecraft.GameUpdater.fatalErrorOccured(GameUpdater.java:766)
  4. at net.minecraft.GameUpdater.loadJarURLs(GameUpdater.java:193)
  5. at net.minecraft.GameUpdater.run(GameUpdater.java:212)
  6. at net.minecraft.Launcher$1.run(Launcher.java:73)
  7. Fatal error occured (2): null
  8. java.lang.NullPointerException
  9. at net.minecraft.GameUpdater.fatalErrorOccured(GameUpdater.java:766)
  10. at net.minecraft.GameUpdater.loadJarURLs(GameUpdater.java:193)
  11. at net.minecraft.GameUpdater.run(GameUpdater.java:212)
  12. at net.minecraft.Launcher$1.run(Launcher.java:73)

Using java/linux-sun-jdk16, audio/linux-f10-openal-soft, and enabling Linux support in x11/nvidia-driver finally lets us start and play the game as normal until Notch fixes the client.

Screenshot of Minecraft Alpha v1.1.2 running on FreeBSD.

/usr/local/linux-sun-jdk1.6.0/bin/java -jar Minecraft.jar
  1. Username is 'okeeblow'