Launch Minecraft From Command Line Username And Password As Prefix

From Marvel vs DC
Jump to: navigation, search

You can do this, you just need to circumvent the launcher.



In %appdata%\.minecraft\bin (or ~/.minecraft/bin on unixy systems), there is a minecraft.jar file. This is the actual game - the launcher runs this.



Invoke it like so:



Set the working directory to .minecraft/bin.



To get the session ID, POST (request this page):



You'll get a response like this:



The fourth field is the session ID. More details here. Read those details, this answer is outdated



Here's an example of logging in to minecraft.net in C#.



- 3



Is there an update to this method? I neither have an %appdata%\.minecraft\bin on my computer (Windows 10) or a minecraft.jar in my appdata folder structure. I do have a 1.9.jar - Tom Resing Feb 29, 2016 at 15:01



The two examples both lead to a 404 and no longer work. - bb216b3acfd8f72cbc8f899d4d6963 Jul 15, 2016 at 14:24



- 2



The main jar file is located at .minecraft\versions\\.jar, libraries are at .minecraft\libraries. login.minecraft.net is down. - AstroRP Oct 26, 2017 at 19:18



@drew-devault: The GitHub example links here are outdated and dead. - beporter Sep 10, 2020 at 23:19



To run Minecraft with Forge (change C:\Users ov11\AppData\Roaming/.minecraft/to your MineCraft path :) [Just for people who are a bit too lazy to search on Google...] Special thanks to ammarx for his TagAPI_3 (Github) which was used to create this command. Arguments are separated line by line to make it easier to find useful ones.



Just when other solutions don't work. accessToken and uuid can be acquired from Mojang Servers, check other anwsers for details.



Edit (26.11.2018): I've also created Launcher Framework in C# (.NET Framework 3.5), which you can also check to see how launcher should work Available Here



For anyone meaning to do this more reliably for different Minecraft versions, I have a Python script (adapted from parts of minecraft-launcher-lib) that does the job very nicely



Besides setting some basic variables near the top after the functions, it calls a get_classpath function that reads for example ~/.minecraft/versions/1.16.5/1.16.5.json, and loops over the property libraries array, checking to see if each object (within the array), is supposed to be added to the classpath (cp variable). whether this library is added to the java classpath is governed by the should_use_library function, deterministic based on the computer's architecture and operating system. finally, some jarfiles that are platform specific have extra things prepended to them (ex. natives-linux in org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-natives-linux.jar). this extra prepended string is handled by get_natives_string and is empty if it doesn't apply to the current library



tested on Linux, distribution Arch Linux



Wonderful, this is exactly what I've been looking for for weeks - thank you so much! One hint: Does not run under Python 2.7 but works for me with Python 3.6, unter Ubuntu 18.04. I changed the first line to python3 and now it runs well for me. Finally no more forced updates and I can (permanently) change my username on my PC this way! - Ethan Arnold Mar 27, 2021 at 17:43



@EthanArnold glad it helped :) I updated the answer to explicitly use python3 in the shebang - hyperupcall Mar 28, 2021 at 0:21



Hi, awesome code but could you please help with making this windows compatible? I'm not sure what tot change and cant get it to work, thanks :) - peter123 Apr 9, 2021 at 18:20



This answer is going to briefly explain how the native files are handled on the latest launcher.



As of 4/29/2017 the Minecraft launcher for Windows extracts all native files and places them info %APPDATA%\Local\Temprandom folder. That folder is temporary and is deleted once the javaw.exe process finishes (when Minecraft is closed). The location of that temporary folder must be provided in the launch arguments as the value of



Also, the latest launcher (2.0.847) does not show you the launch arguments so if you need to check them yourself you can do so under the Task Manager (simply enable the Command Line tab and expand it) or by using the WMIC utility as explained here.



Hope this helps some people who are still interested in doing this in 2017.



Thank you ! Where does the launcher take the .dll that are stored in the %APPDATA%\Local\Temprandom folder ? - Dardan Iljazi Dec 31, 2017 at 20:02



@Dardanboy The dll in the folder are added to the java classpath so that the native functions will work properly. Once the java process is no longer running, the dll are no longer needed and are then deleted. - d_scalzi Dec 31, 2017 at 21:36



Yeah I understood it. But I think that the launcher download those files from a server. Titan Launcher For Mc Do you know from where it download them before putting them into this temporary folder (and then like you said link them with javaw.exe ?) - Dardan Iljazi Dec 31, 2017 at 21:39



- 1



All libraries are listed in a version index on the site https://s3.amazonaws.com/Minecraft.Download/versions/version/version.json. Using 1.12.2 as an example, s3.amazonaws.com/Minecraft.Download/versions/1.12.2/1.12.2.json - d_scalzi Dec 31, 2017 at 21:44



Thank you, your comment bring me to this: gist.github.com/dequis/d24ce9d9915401f13dd1 (I put it for people that come here) - Dardan Iljazi Dec 31, 2017 at 21:53



Just create this batch command file in your game directory. Bat file takes one argument %1 as the username.



Also, I use a splash screen to make pretty. You will NOT be able to play online, but who cares.



Adjust your memory usage to fit your machine (-Xmx & -Xmns).



NOTE: this is for version of minecraft as of 2016-06-27



You will be able to play online if you replace the uuid and accesstoken with data you can get from logging in to the auth server, whether via curl or another program. - dma1324 Dec 14, 2016 at 20:04



Those are all ways to start the standard minecraft launcher with those credentials in the text boxes.



There used to be a way to login to minecraft without the launcher using the command line, but it has since been patched.



If you want to make a custom launcher using the command line then good luck, the only way to login to the minecraft jar(IE: the way the launcher does it) is to send a post request to https://login.minecraft.net/ with the username,password,launcher version, and a RSA key. It then parses the pseudo Json, and uses the session token from that to authenticate the jar from the command line with a load of arguments.



If you are trying to make a minecraft launcher and you have no knowledge of java,http requests or json then you have no chance.



Swift



Aww, that really sucks. Wonder why they patched it? It would've made making custom launchers so much easier, without being a security issue... - mort Jan 25, 2013 at 23:56



It was a security issue, anyone could see your password in plain text being sent accross the network. - Excalibur Jan 26, 2013 at 9:40



-



This is not correct, third party launchers can still work. I'll provide an answer with the information below. - Drew DeVault Mar 22, 2013 at 3:39



Not the answer you're looking for? Browse other questions tagged java terminal cmd launcher minecraft or ask your own question.