WIP [Tutorial] How to run Minecraft: Java Edition on the nintendo switch with linux

Discussion in 'Switch - Exploits, Custom Firmwares & Soft Mods' started by NekoNoor, May 7, 2018.

  1. NekoNoor
    OP

    NekoNoor Member

    Newcomer
    3
    Oct 13, 2015
    Netherlands
    THIS DOES NOT WORK YET! Scroll down to the bottom if you would like to help.

    For this tutorial I am assuming you already have linux set up with the KDE + graphics acceleration rootfs.
    If you haven't set it up. Check out how to do that in this thread: https://gbatemp.net/threads/quick-tuto-how-to-boot-linux-on-your-switch.501918/

    This tutorial is based off an existing tutorial for the raspberry pi: https://www.raspberrypi.org/forums/viewtopic.php?t=186547
    The run script isn't mine and was written by rogerallen, i have adapted it to work on the nintendo switch.

    On SSH, run:
    Code:
    sudo pacman -Syu freealut jre9-openjdk jre8-openjdk wget jdk8-openjdk apache-ant base-devel
    mkdir ~/Minecraft
    mkdir ~/Minecraft/Natives
    cd ~/Minecraft
    wget https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar
    sudo archlinux-java set java-9-openjdk
    
    On the Switch, run:
    Code:
    cd ~/Minecraft
    java -jar Minecraft.jar
    
    Now you should see the Minecraft launcher, log in with your e-mail and password and press play (just be sure to select 1.12.2 as the version). It should download all the files it needs and crash, that's fine for now.

    On SSH, run:
    Code:
    cd ~/Minecraft/Natives
    wget https://gist.github.com/Seddigirl/05f2a409c014ee4b245d94cb21168923/raw/9129f2ab262199c30305a9d00714fb683100c54c/liblwjgl.so
    wget https://gist.github.com/Seddigirl/05f2a409c014ee4b245d94cb21168923/raw/d11ce3b1794f25bb63e31887000c8eb578ec51d2/libopenal.so
    cd ~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209
    rm lwjgl-2.9.4-nightly-20150209.jar
    wget https://www.dropbox.com/s/mj15sz3bub4dmr6/lwjgl-2.9.4-nightly-20150209.jar
    
    On the switch, open a browser, go to https://optifine.net/downloads and download OptiFine 1.12.2 HD U D2.

    On the Switch, run:
    Code:
    cd ~/Downloads
    java -jar OptiFine_1.12.2_HD_U_D2.jar
    
    It should open the installer, click "install" and wait for it to complete.

    On the Switch, run:
    Code:
    cd ~/Minecraft
    java -jar Minecraft.jar
    
    Press play (make sure the "OptiFine" profile is selected) it should download all the necessary files and crash.

    On SSH, run:
    Code:
    cd ~/Minecraft
    wget https://gist.githubusercontent.com/Seddigirl/036a578a070b85dd15775434746d8204/raw/1872a835cd2d36d51a79f142997307f760009538/runOptifine1_12_2.sh
    sudo chmod +x runOptifine1_12_2.sh
    sudo archlinux-java set java-8-openjdk
    
    Edit runOptifine1_12_2.sh with the required information (dont forget the clienttoken and uuid which you can get from ~/.minecraft/launcher_profiles.json).

    What you need to edit:
    Code:
    # !!! YOU MUST PERSONALIZE ALL OF THIS INFO !!!
    # your personal login/password.  chmod 700 to keep this private
    MINECRAFT_LOGIN=aaa@bbb.ccc
    MINECRAFT_USERNAME=abcdefghi
    MINECRAFT_PASSWORD=xxxxxxxx
    # where did you store the native liblwjgl.so and libopenal.so?
    MINECRAFT_NATIVE_PATH=~/Minecraft/Natives
    # info from initial run data in .minecraft/launcher_profiles.json
    MINECRAFT_CLIENTTOKEN=b61fb8e9-97bf-435f-8354-1feaba0ce734
    MINECRAFT_UUID=12345678-1234-1234-1234-123456789abc
    MINECRAFT_VERSION=1.12
    
    This should be everything you need to run Minecraft: Java Edition on the Nintendo Switch!

    On the Switch, run:
    Code:
    cd ~/Minecraft
    ./runOptifine1_12_2.sh
    
    This is the part where i need your help:

    When running minecraft after it has loaded everything and the window pops up, i get an error saying:
    Code:
    X Error - disp: 0xffffaca68080 serial: 79 error: BadPixmap (invalid Pixmap parameter) request_code: 54 minor_code: 0
    Full error log: https://gist.github.com/Seddigirl/f3f673cc3f3bc5b198019e37564595f9

    I think this might have something to do with the way i compiled LWJGL, for more info on how to compile lwjgl yourself for the nintendo switch check here: https://github.com/LWJGL/lwjgl/issues/74 and here: http://rogerallen.github.io/jetson/2014/07/31/minecraft-on-jetson-tk1/

    Just clone this: https://github.com/Seddigirl/lwjgl and symlink libjawt.so like this:

    Code:
    ln -s /usr/lib/jvm/java-8-openjdk/lib/aarch64/libjawt.so /usr/lib/libjawt.so
    
    LWJGL2 should now compile properly on the nintendo switch.

    Just run:
    Code:
    ant generate-all
    ant compile
    ant compile_native
    
    And it should compile properly

    We need to figure out what's causing the X Error on launch. I think it might have something to do with how lwjgl is compiled but i'm not sure. It could have something to do with the graphics drivers too.
     
    Last edited by NekoNoor, May 7, 2018
  2. PabloMK7

    PabloMK7 Red Yoshi! ^ω^

    Member
    10
    Feb 21, 2014
    Spain
    Yoshi's Island
    I already tried to run minecraft as well. The problem I have is that the JVM crashes :/
    I also had to compile that library and I did it successfully.

    I have read that the ARM oracle VM is buggy so we have to use Jam VM instead.
     
    The9thBit likes this.
  3. NekoNoor
    OP

    NekoNoor Member

    Newcomer
    3
    Oct 13, 2015
    Netherlands
    I am not using the oracle VM, i'm using the openjdk vm, the jvm doesnt crash for me and the issue i'm having is described in the main post.
     
  4. LucaFraga

    LucaFraga Advanced Member

    Newcomer
    5
    Aug 10, 2009
    Italy
  5. Sinful Shadow

    Sinful Shadow GBAtemp Regular

    Member
    3
    Apr 10, 2016
    United States
    IF you can even get this to work would the switch even be able to run the java version of minecraft without like exploding? XD
     
  6. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    18
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    Actually, it would result in a chain reaction efficient enough to swipe the Northern Hemisphere away, turning the Earth into a very watery Semisphere... (?)
     
    LooP403, renhei and Sarayalth like this.
  7. Jayro

    Jayro MediCat USB and Mini Windows 10 Developer

    Member
    14
    GBAtemp Patron
    Jayro is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 23, 2012
    United States
    Octo Canyon
    The Switch has 4GB of RAM. So if Minecraft can run on the 360 with only 512MB RAM, then the Switch can handle regular (Java) Minecraft.
     
  8. coon-strudel

    coon-strudel That one weird Furry Artist

    Member
    5
    Apr 21, 2015
    United States
    My own little world
    The sheer thought of potentially being able to play Roblox on a official Nintendo console sends chills down my spine. (No offense to Roblox players, this is more of a playfully joking comment. Also DOES having Linux and running wine give potential to play full fledged PC games? Or can we also utilize Windows too at some point?)
     
    NutymcNuty likes this.
  9. smileyhead

    smileyhead Yes.

    Member
    16
    Aug 31, 2015
    Hungary
    Budakeszi, Hungary
    Every console is running Minecraft C++, not Minecraft Java. The Java version is horribly optimised. It should still run fine with the Switch's specs, though.
     
  10. Jayro

    Jayro MediCat USB and Mini Windows 10 Developer

    Member
    14
    GBAtemp Patron
    Jayro is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 23, 2012
    United States
    Octo Canyon
    Ah, thanks for clearing that up for me. But yeah, I have faith it can handle the java version just fine. Probably a few light mods too without much trouble, but nothing like shaders or crazy 512x512 texturepacks. Maybe packs like Faithful x32.
     
    smileyhead likes this.
  11. tunip3

    tunip3 [debugger active]

    Banned
    7
    Oct 31, 2016
    United Kingdom
    Wine is not going to run Windows apps wine is not an emulator it doesn't not emulate x86 or x64
     
    Orangy57 and nmkd like this.
  12. PatrickJr

    PatrickJr GBAtemp Regular

    Member
    4
    Jan 5, 2017
    Bridgwater
    could you try sudo snap install minecraft

    make sure you have snapd
     
  13. NekoNoor
    OP

    NekoNoor Member

    Newcomer
    3
    Oct 13, 2015
    Netherlands
    That downloads the libraries built for x86 platforms. it downloads it from https://downloads.sourceforge.net/project/java-game-lib/Official Releases/LWJGL 2.9.3/lwjgl-2.9.3.zip

    The problem isnt that i cant install minecraft, the snap downloads a package which includes the x86 libraries. those dont work on the switch

    A raspberry pi 3 can run the game just fine with ~30fps if you lower all the settings
     
    Last edited by NekoNoor, May 7, 2018
    nmkd likes this.
  14. Minox

    Minox Thanks for the fish

    Former Staff
    14
    Aug 27, 2007
    Japan
    No, it does not. The reason why Minecraft and other Java-based applications might work is because it is compiled to run under a Java Virtual Machine so assuming a JVM-implementation is readily available on your platform and there aren't any issues with other dependencies needed it should work.

    What this doesn't do is emulate another CPU architecture which is what you would need to do to run x86-based software on an ARM-based CPU.
     
    Orangy57, nmkd and Brawl345 like this.
  15. NekoNoor
    OP

    NekoNoor Member

    Newcomer
    3
    Oct 13, 2015
    Netherlands
    Please create a different thread if you would like to discuss running x86 programs through wine on the switch
     
  16. Minox

    Minox Thanks for the fish

    Former Staff
    14
    Aug 27, 2007
    Japan
    We are simply explaining why this topic of yours does not imply what this user thinks. There is no intention to start a discussion about such a thing as that would be completely offtopic.
     
  17. NekoNoor
    OP

    NekoNoor Member

    Newcomer
    3
    Oct 13, 2015
    Netherlands
    Ah yeah that makes sense, apologies.
     
  18. Hipeopeo

    Hipeopeo Advanced Member

    Newcomer
    2
    Apr 22, 2017
    United States
    Pretty Much Hell
    Cool! I remember doing this on the Pi 3!
     
    coppertj likes this.
  19. nmkd

    nmkd GBAtemp Advanced Fan

    Member
    5
    Oct 25, 2016
    Germany
    People have done this on a RPi, Switch could easily handle PC Minecraft at low settings.
     
  20. coon-strudel

    coon-strudel That one weird Furry Artist

    Member
    5
    Apr 21, 2015
    United States
    My own little world
    Sorries for the trouble.
     
Loading...