Playing Minecraft on FreeBSD

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.

  1. [nicole@Emi#Desktop]java -version
  2. java version "1.6.0_03-p4"
  3. Java(TM) SE Runtime Environment (build 1.6.0_03-p4-nicole_17_aug_2010_02_15-b00)
  4. 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

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

I then tried java/openjdk6.

  1. [nicole@Emi#Desktop]java -version
  2. openjdk version "1.6.0"
  3. OpenJDK Runtime Environment (build 1.6.0-b20)
  4. 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.

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

  1. [nicole@Emi#Desktop]java -Djava.net.preferIPv4Stack=true -jar Minecraft.jar
  2. Username is 'okeeblow'
  3. java.lang.NullPointerException
  4. at net.minecraft.GameUpdater.fatalErrorOccured(GameUpdater.java:766)
  5. at net.minecraft.GameUpdater.loadJarURLs(GameUpdater.java:193)
  6. at net.minecraft.GameUpdater.run(GameUpdater.java:212)
  7. at net.minecraft.Launcher$1.run(Launcher.java:73)
  8. Fatal error occured (2): null
  9. java.lang.NullPointerException
  10. at net.minecraft.GameUpdater.fatalErrorOccured(GameUpdater.java:766)
  11. at net.minecraft.GameUpdater.loadJarURLs(GameUpdater.java:193)
  12. at net.minecraft.GameUpdater.run(GameUpdater.java:212)
  13. 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.

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