Skip to content

Instantly share code, notes, and snippets.

@mendes5
Last active Mar 23, 2022
Embed
What would you like to do?
How to launch minecraft java ediction from the command line

Minecraft is intended to be launched by the minecraft launcher to do login stuff, integrity verification, premium status check, etc... So its difficult to launch it from a comand line for diagnostic porpuses (For example attaching a RenderDoc process to it)

When you launch Minecraft, the launcher spawn the process

C:\Program Files (x86)\Minecraft Launcher\runtime\jre-x64\bin\javaw.exe

In the CWD:

C:\Users\User\AppData\Roaming\.minecraft\

With the arguments (in case you have OptFine installed)

-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump "-Dos.name=XXXX" -Dos.version=XXXX -Xss1M -Djava.library.path=C:\Users\User\AppData\Roaming\.minecraft\bin\XXXX-XXXX-XXXX-XXXX -Dminecraft.launcher.brand=minecraft-launcher -Dminecraft.launcher.version=2.1.9616 -cp C:\Users\User\AppData\Roaming\.minecraft\libraries\optifine\OptiFine\1.14.4_HD_U_F3\OptiFine-1.14.4_HD_U_F3.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\optifine\launchwrapper-of\2.1\launchwrapper-of-2.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\mojang\patchy\1.1\patchy-1.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\jna\4.4.0\jna-4.4.0.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\mojang\javabridge\1.0.22\javabridge-1.0.22.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\5.0.3\jopt-simple-5.0.3.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\21.0\guava-21.0.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.5\commons-lang3-3.5.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.5\commons-io-2.5.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\mojang\brigadier\1.0.17\brigadier-1.0.17.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\mojang\datafixerupper\2.0.24\datafixerupper-2.0.24.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.25\authlib-1.5.25.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\it\unimi\dsi\fastutil\8.2.1\fastutil-8.2.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.8.1\log4j-api-2.8.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.8.1\log4j-core-2.8.1.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\3.2.2\lwjgl-3.2.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl-jemalloc\3.2.2\lwjgl-jemalloc-3.2.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl-openal\3.2.2\lwjgl-openal-3.2.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl-opengl\3.2.2\lwjgl-opengl-3.2.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl-glfw\3.2.2\lwjgl-glfw-3.2.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl-stb\3.2.2\lwjgl-stb-3.2.2.jar;C:\Users\User\AppData\Roaming\.minecraft\libraries\com\mojang\text2speech\1.11.3\text2speech-1.11.3.jar;C:\Users\User\AppData\Roaming\.minecraft\versions\1.14.4-OptiFine_HD_U_F3\1.14.4-OptiFine_HD_U_F3.jar -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M -Dlog4j.configurationFile=C:\Users\User\AppData\Roaming\.minecraft\assets\log_configs\client-1.12.xml net.minecraft.launchwrapper.Launch --username XXXXXXXXX --version 1.14.4-OptiFine_HD_U_F3 --gameDir C:\Users\User\AppData\Roaming\.minecraft --assetsDir C:\Users\User\AppData\Roaming\.minecraft\assets --assetIndex 1.14 --uuid XXXXXXXXXXXXXXXXXXXXXXXXXXXXX --accessToken XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --userType mojang --versionType release --tweakClass optifine.OptiFineTweaker

But there is a argument that changes everytime

-Djava.library.path=C:\Users\User\AppData\Roaming\.minecraft\bin\XXXX-XXXX-XXXX-XXXX

You can see that in the folder C:\Users\User\AppData\Roaming\.minecraft\bin a new folder is added everytime you launch a Minecraft instance, the contents of the folder are allways the same.

So the trick is the following.

  • Launch a Minecraft instance
  • Copy the command line arguments that the launcher created for this launch (on windows I think that the task manager has this option, but i use https://www.geeks3d.com/dl/show/10078 so i dont know)
  • Wait for the new folder at C:\Users\User\AppData\Roaming\.minecraft\bin\<some UUID name> to be created
  • Copy the folder and rename it to something silly, in my case: RENDER_DOC_BIN
  • Once the instance is fully initialized close it, the original folder will be deleted by the launcher
  • Launch the C:\Program Files (x86)\Minecraft Launcher\runtime\jre-x64\bin\javaw.exe process with the copied arguments, but change the -Djava.library.path argument to point to your copied folder, in my case C:\Users\User\AppData\Roaming\.minecraft\bin\RENDER_DOC_BIN and the CWD at C:\Users\User\AppData\Roaming\.minecraft
  • Minecraft should now launch even without the launcher
  • You can reuse the RENDER_DOC_BIN folder as many times you want as the launcher will never delete it

IMPORTANT NOTE Avoid sharing the command line arguments of the launched minecraft instance as they contain access tokens that can be used to login on your account

@bc-185
Copy link

bc-185 commented Oct 4, 2020

The problem is that you can't access Realms. I have worked around it. To solve it, when you get to step 4, rename the folder to exactly what it was before it was deleted (it is not case sensitive), and make sure it is still in %appdata%\.minnecraft\bin. Don't worry, the Minecraft launcher won't delete it.

@kmcnaught
Copy link

kmcnaught commented Jun 17, 2021

Thanks, this was helpful 👍

@ChefAnthonyy
Copy link

ChefAnthonyy commented Jul 6, 2021

BTW: You want to find the argument that comes from the actual game client, not one of the instances of the launcher that runs alongside it. It'll either be called "Java (TM) Platform SE Binary" (for older versions of the game), or "OpenJDK Platform Binary". You should get a really long argument that starts with a drive path. From there, find -Djava.library.path= and edit in the file path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment