# Minecraft - Launching game in Terminal and Command Prompt



## SuperMarioDaBom (Nov 29, 2016)

I've been working on a Minecraft server manager application in Unity3d (Yes, its in a game engine. I did that so that making it multi-platform would be extremely simple, and I am very familiar with the Unity api). I am implementing a function to launch Minecraft in-app, bypassing the official Minecraft launcher.

I already implemented the Minecraft authentication api, so getting the access token is already handled. The one thing that is frustrating me is that I cannot get Minecraft to launch from terminal. Once that gets done, implementation into Unity will be a piece of cake.

That being said, can someone give me the terminal command that will launch it? Obviously with the necessary place-holders. Thanks in advance. This has been frustrating me to no end, and Google doesn't seem to wanna help. All I could find were the old pre-yggdrasil commands.

Thanks again.


----------



## SuperMarioDaBom (Jan 8, 2017)

Is there anyone that can help? I feel kinda bad for bumping my own thread, but its been since November and not one single reply has been made.


----------



## Joom (Jan 10, 2017)

java - jar minecraft.jar

Of course, other parameters for Java can be passed, but this is the most basic way of loading it. Unless of course this doesn't work anymore. I haven't played the game in well over a year.


----------



## SuperMarioDaBom (Jan 10, 2017)

Joom said:


> java - jar minecraft.jar
> 
> Of course, other parameters for Java can be passed, but this is the most basic way of loading it. Unless of course this doesn't work anymore. I haven't played the game in well over a year.



That's the base of it, but it requires a whole ton of arguments to launch. Some of these are the Access Code, libraries, etc.

Apparently the command is EXTREMELY long. I tried getting it from Minecraft's code, but it only gives "half" of it, which already is really long. When typing that half command in, it gives an error that it can't find a library - probably because it is not implemented into the code.


----------



## evandixon (Jan 10, 2017)

If you're using Windows 8 or above, you can launch Minecraft, then use Task Manager to display all the command-line arguments Java was run with.  It should be a simple matter to mimic that afterward.


----------



## SuperMarioDaBom (Jan 11, 2017)

Ok, I appear to have found something useful! I used ProcessExplorer, as Task Manager wasn't giving the command in its entirety due to how long it is. Here it is:

"C:\Program Files (x86)\Minecraft\runtime\jre-x64\1.8.0_25\bin\javaw.exe" -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M "-Dos.name=Windows 10" -Dos.version=10.0 "-Djava.library.path=C:\Users\<username>\AppData\Roaming\.minecraft\versions\1.8.9\1.8.9-natives-34757015043807" -cp "C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\netty\1.6\netty-1.6.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\17.0\guava-17.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\realms\1.7.59\realms-1.7.59.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\6.5\twitch-6.5.jar;C:\Users\<username>\AppData\Roaming\.minecraft\versions\1.8.9\1.8.9.jar" net.minecraft.client.main.Main --username <gameuser> --version 1.8.9 --gameDir "C:\Users\<username>\AppData\Roaming\.minecraft" --assetsDir "C:\Users\<username>\AppData\Roaming\.minecraft\assets" --assetIndex 1.8 --uuid <uuid> --accessToken <accesstoken> --userProperties {} --userType legacy --nativeLauncherVersion 307

Please note: <username> is your home folder. <gameuser> is your Minecraft username. <uuid> is your player's uuid. <accesstoken> is the accessToken (must be valid, otherwise will not work). This also is specific to Win10 I believe, so it might require editing for different versions. It is set to 1.8.9, but as seen above this can be pretty easily changed.

I will soon be porting this to macOS and other Windows versions! Thanks @UniqueGeek for the lead! 

This was tested on Win10. It works perfectly just as long as the accessToken is valid!


----------



## Joom (Jan 11, 2017)

Why is all of that necessary? Shouldn't invoking the main JAR do all of that? I also noticed that it's using fixed memory allocations, which won't be ideal for all users.


----------



## Deleted User (Jan 11, 2017)

UniqueGeek said:


> If you're using Windows 8 or above, you can launch Minecraft, then use Task Manager to display all the command-line arguments Java was run with.  It should be a simple matter to mimic that afterward.


What? How do you get this?

And you are making a server manager? For Minecraft, with Unity? Maybe you could make a GUi for this in the future so you won't have to deal with command line


----------



## SuperMarioDaBom (Jan 11, 2017)

Joom said:


> Why is all of that necessary? Shouldn't invoking the main JAR do all of that? I also noticed that it's using fixed memory allocations, which won't be ideal for all users.



It is necessary, in order for Minecraft to have access to all of the libraries and things that it needs. Also yes, it uses fixed memory allocations. Though it is customizable in the Minecraft Launcher. 



VinLark said:


> And you are making a server manager? For Minecraft, with Unity? Maybe you could make a GUi for this in the future so you won't have to deal with command line



GUI for what? I don't understand what you mean.


----------



## Deleted User (Jan 11, 2017)

SuperMarioDaBom said:


> It is necessary, in order for Minecraft to have access to all of the libraries and things that it needs. Also yes, it uses fixed memory allocations. Though it is customizable in the Minecraft Launcher.
> 
> 
> 
> GUI for what? I don't understand what you mean.


GUI for the server manager.....

oh forget it


----------



## Deleted User (Jan 11, 2017)

SuperMarioDaBom said:


> It is necessary, in order for Minecraft to have access to all of the libraries and things that it needs. Also yes, it uses fixed memory allocations. Though it is customizable in the Minecraft Launcher.
> 
> 
> 
> GUI for what? I don't understand what you mean.


He's referring to something such as Multicraft or mcmyadmin. They are full guis(big shiny clicky buttons) that do most tasks, instead of using terminal

EDIT: For example here is the one that I use everyday for work. Do I get bonus points for the fancy editing?


----------



## Joom (Jan 11, 2017)

SuperMarioDaBom said:


> It is necessary, in order for Minecraft to have access to all of the libraries and things that it needs. Also yes, it uses fixed memory allocations. Though it is customizable in the Minecraft Launcher.


When did this happen, or is it only pertinent for your manager to work? I used to invoke the JAR with a Bash script that was just a single line with memory allocations for my system. Maybe it's different on Windows. I don't really know. It'd be interesting to test your MacOS build when it's done.


----------



## SuperMarioDaBom (Jan 11, 2017)

VinLark said:


> GUI for the server manager.....
> 
> oh forget it





Sasori said:


> He's referring to something such as Multicraft or mcmyadmin. They are full guis(big shiny clicky buttons) that do most tasks, instead of using terminal
> 
> EDIT: For example here is the one that I use everyday for work. Do I get bonus points for the fancy editing?



Ah, I see where that may have been confusing. The app I'm making will download and create the server for the specified version, then launch the corresponding version of Minecraft itself. It achieves this by authenticating through yggdrasil - Mojang's authentication servers. I hope this clears up any confusion.

Lol 10/10 for best edits ever 



Joom said:


> When did this happen, or is it only pertinent for your manager to work? I used to invoke the JAR with a Bash script that was just a single line with memory allocations for my system. Maybe it's different on Windows. I don't really know. It'd be interesting to test your MacOS build when it's done.



Its been that way ever since Minecraft switched launchers, I believe (2013?). I have only been playing Minecraft since its 1.8 release, so I'm not too well informed on how it worked before then. Don't expect anything very soon, though. I'm fairly busy irl and also tend to procrastinate on things.  Since I now know someone wants a release, I shall put this towards the top of my priorities.


----------



## Joom (Jan 11, 2017)

SuperMarioDaBom said:


> Its been that way ever since Minecraft switched launchers, I believe (2013?). I have only been playing Minecraft since its 1.8 release, so I'm not too well informed on how it worked before then. Don't expect anything very soon, though. I'm fairly busy irl and also tend to procrastinate on things.  Since I now know someone wants a release, I shall put this towards the top of my priorities.


Ah, ok. I haven't really played since 1.5.2 or so, so that makes sense. Now I kinda want to try the latest build and see if I can figure out a simpler way to launch it. Honestly, it seems rather regressive to make that wall of text necessary, but I'm not a game developer, so what do I know?


----------



## SuperMarioDaBom (Jan 11, 2017)

Joom said:


> Ah, ok. I haven't really played since 1.5.2 or so, so that makes sense. Now I kinda want to try the latest build and see if I can figure out a simpler way to launch it. Honestly, it seems rather regressive to make that wall of text necessary, but I'm not a game developer, so what do I know?



I don't think there is any easier way to launch it from command line, unfortunately. It needs all that info to launch. I think it also protects from piracy, so that it becomes a whole lot harder to implement ALL of those libraries, plus a valid accessToken. The harder it is, the less likely someone is gonna try and circumvent it.


----------



## Joom (Jan 11, 2017)

SuperMarioDaBom said:


> I don't think there is any easier way to launch it from command line, unfortunately. It needs all that info to launch. I think it also protects from piracy, so that it becomes a whole lot harder to implement ALL of those libraries, plus a valid accessToken. The harder it is, the less likely someone is gonna try and circumvent it.


I suppose. I know of quite a few cracked launchers floating around that support the latest build, and this is due to the nature of Minecraft (which hasn't changed in the licensing department for quite a while). If they'd implement hardware ID licensing (say the ID of your hard drive or processor licenses the software) then it'd be much harder to crack, and wouldn't require legitimate customers and community developers to go through all these arduous tasks just to launch the game. But meh, I'm getting off-topic. I'll keep up for that Mac build and see if I can help in any way once it's done.


----------



## evandixon (Jan 11, 2017)

Wait, you're making a _server_ manager?  You shouldn't need to deal with access tokens for servers.

For a server, it should just be:

```
java -jar {minecraft server jar} -server -Xms{min memory}M -Xmx{max memory}M nogui
```


----------



## Joom (Jan 11, 2017)

UniqueGeek said:


> Wait, you're making a _server_ manager?  You shouldn't need to deal with access tokens for servers.
> 
> For a server, it should just be:
> 
> ...


See, that's what I was thinking. I wonder if Unity is what's giving OP problems, but I really don't know much about this.


----------



## evandixon (Jan 11, 2017)

Joom said:


> See, that's what I was thinking. I wonder if Unity is what's giving OP problems, but I really don't know much about this.


I don't know much about Unity, but since it's C#, hopefully it has all the OP needs: System.Diagnostics.Process


----------



## Joom (Jan 11, 2017)

UniqueGeek said:


> I don't know much about Unity, but since it's C#, hopefully it has all the OP needs: System.Diagnostics.Process


Wait, Unity is just C#? That makes it seem rather overly glorified, but I have a personal animosity against .NET languages.


----------



## SuperMarioDaBom (Jan 11, 2017)

UniqueGeek said:


> Wait, you're making a _server_ manager?  You shouldn't need to deal with access tokens for servers.
> 
> For a server, it should just be:
> 
> ...





Joom said:


> See, that's what I was thinking. I wonder if Unity is what's giving OP problems, but I really don't know much about this.



I'm very sorry if this is confusing to anyone. Maybe I need to rephrase myself to make it clear.

I'm making a server manager. In Unity3d. What it will do is download, install, and run these servers. The user chooses what MC version the server will use.

One of the features that it will have is launching the full game as well as the server. It will launch the version of Minecraft that the server is running. This is to help make the server-making process a little more automated and make it easier for n00bs to play with friends.

Launching a server from command line is relatively easy. This has already been implemented into my project; what I was missing was launching the game itself.



UniqueGeek said:


> I don't know much about Unity, but since it's C#, hopefully it has all the OP needs: System.Diagnostics.Process



Yes; this is how I launch the server, and probably how I am going to launch the game itself as well.



Joom said:


> Wait, Unity is just C#? That makes it seem rather overly glorified, but I have a personal animosity against .NET languages.



Unity is C# and Java. It used to support Boo - idk what ever happened to that though.


----------



## Joom (Jan 11, 2017)

Does that mean that Unity projects for consoles come with a built-in interpreter, or are the languages translated upon compilation? Again, sorry for going off-topic, but I'm intrigued now.


----------



## SuperMarioDaBom (Jan 11, 2017)

Joom said:


> Does that mean that Unity projects for consoles come with a built-in interpreter, or are the languages translated upon compilation? Again, sorry for going off-topic, but I'm intrigued now.



Its ok! There's no harm in being intrigued! I honestly don't know. I believe that its the latter, but I could be mistaken.


----------



## evandixon (Jan 11, 2017)

SuperMarioDaBom said:


> I'm very sorry if this is confusing to anyone. Maybe I need to rephrase myself to make it clear.
> 
> I'm making a server manager. In Unity3d. What it will do is download, install, and run these servers. The user chooses what MC version the server will use.
> 
> One of the features that it will have is launching the full game as well as the server. It will launch the version of Minecraft that the server is running. This is to help make the server-making process a little more automated and make it easier for n00bs to play with friends.


It may be worth analyzing how the Curse launcher works.  It manages the files and stuff, but when it comes time to run the game, it runs the official launcher instead, so _it_ can handle auth stuff.  While I'm sure you'd never do anything sketchy, users would only have to give their MC passwords to the official launcher, possibly making them feel a little better about password theft.


----------



## SuperMarioDaBom (Jan 11, 2017)

UniqueGeek said:


> It may be worth analyzing how the Curse launcher works.  It manages the files and stuff, but when it comes time to run the game, it runs the official launcher instead, so _it_ can handle auth stuff.  While I'm sure you'd never do anything sketchy, users would only have to give their MC passwords to the official launcher, possibly making them feel a little better about password theft.



I see what you mean. In a sense, it behaves almost identical to the official launcher when it comes to logging in and such, except for the fact that it doesn't yet save the accessToken to keep the player "signed in". Once its somewhat complete, I can make it open source, if that makes anyone feel better. If anyone manages to get the password from my app, then they can get it the exact same way from the official launcher!


----------



## SuperMarioDaBom (Jan 12, 2017)

Sorry for the double post! I felt that this should be separated from the message above.

I appear to also have the command for macOS! Tested it and it worked, see command below:

/Applications/Minecraft.app/Contents/runtime/jre-x64/1.8.0_74/bin/java -Xdock:icon="/Users/<username>/Library/Application Support/minecraft/assets/objects/99/991b421dfd401f115241601b2b373140a8d78572" -Xdock:name=Minecraft -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M -Djava.library.path="/Users/<username>/Library/Application Support/minecraft/versions/1.8.9/natives" -cp "/Users/<username>/Library/Application Support/minecraft/libraries/com/mojang/netty/1.6/netty-1.6.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/google/guava/guava/17.0/guava-17.0.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/mojang/authlib/1.5.21/authlib-1.5.21.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/com/mojang/realms/1.7.59/realms-1.7.59.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar":"/Users/<username>/Library/Application Support/minecraft/libraries/tv/twitch/twitch/6.5/twitch-6.5.jar":"/Users/<username>/Library/Application Support/minecraft/versions/1.8.9/1.8.9.jar" net.minecraft.client.main.Main --username <gamename> --version 1.8.9 --gameDir "/Users/<username>/Library/Application Support/minecraft" --assetsDir "/Users/<username>/Library/Application Support/minecraft/assets" --assetIndex 1.8 --uuid <uuid> --accessToken <accesstoken> --userProperties {} --userType mojang --nativeLauncherVersion 308

NOTE: This will launch Minecraft version 1.8.9, when the variables are replaced with their proper info. Another thing to note is the -Djava.library.path has been altered; apparently minecraft generates a "natives" folder, with a bunch of numbers in the name of it. It gets deleted when minecraft closes. I believe its generated by the launcher, so it needs to exist in order to run. I copied it while a regular run of Minecraft was running, then specified it in the command above. It works perfectly. Any variables in this are identical to the ones for the windows command.

Now that I have the two commands, I can begin implementation in my app! Expect a beta soon!


----------

