Hot Summer Deals are Here!
Celebrate with up to 99% off on 17,800 resources
00
Days
20
Hours
07
Mins
20
Secs

[Client] Run Minecraft Jar / Client from the Command Line

Status
This thread has been locked.

luaq

Supreme
Feedback score
7
Posts
141
Reactions
40
Resources
0
Hey, so I've been doing a fair bit of research and I have been trying to figure out how to run Minecraft through the command line and I simply cannot figure it out. All the commands I've tried have failed me in working. If any developers could assist me that'd be much appreciated, thanks!
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Kuzni

If you signed up after 2016 don't diss me thx
Supreme
Feedback score
12
Posts
1,688
Reactions
950
Resources
0
Do you mean just starting up the launcher via cmd or?
 

luaq

Supreme
Feedback score
7
Posts
141
Reactions
40
Resources
0
Do you mean just starting up the launcher via cmd or?
I mean starting the literal game via the command line. For example, I could launch the 1.8.9.jar via the command line.
 

Bryce

Senior Java & Full-Stack Developer
Supreme
Feedback score
18
Posts
678
Reactions
934
Resources
19
The command is actually huge. You must make sure all the correct libraries & natives are downloaded and in the correct place, so the commandline will work. By default the libraries are downloaded by the launcher, but not until you press play for the first time. A good way to make sure all the correct libraries are downloaded and in the correct spot, run the official launcher, download your version and press play. It will generate all the dependencies, then start your game.



This was the last working commandline I established a few years back while working on a launcher. This is specifically for windows and the commandline is platform-dependent. You'll notice there is a few variables that need to get filled in.

Replace: + PCUser +
With: Your computers name. E.G Bryce-PC

Replace: + username +
With: Your Minecraft Username

Replace: + dir +
With: Your came root directory (default is the well known %appdata% path)

Replace: + client +
With: Your account UUID

Replace: + session +
With: The client token generated by the Mojang Session servers (https://wiki.vg/Authentication#Authenticate)
*Note: only required if you plan on connecting to servers

Replace: ANY 1.8.8
With: Your intended version of the game

**Note:
This commandline will not work, unless you take all the required natives, and move them to:

"gameDir/versions/versionHere/natives".

And ensure the Libraries have been downloaded by the official Mojang launcher.

Code:
java -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M -Dos.name=Windows10 -Dos.version=10.0 -Djava.library.path=C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\versions\1.8.8\natives -cp C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\17.0\guava-17.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\mojang\realms\1.7.39\realms-1.7.39.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\6.5\twitch-6.5.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\versions\1.8.8\1.8.8.jar net.minecraft.client.main.Main --username " + username + " --version 1.8.8 --gameDir C:\Users\" + PCUser + "\AppData\Roaming\.minecraft --assetIndex 1.8 --uuid " + client + " --accessToken " + session + " --userProperties {} --userType mojang"


Hopefully I gave you enough to get a running start. It took some interesting methods to get this entire commandline put together.
 
Last edited:

luaq

Supreme
Feedback score
7
Posts
141
Reactions
40
Resources
0
The command is actually huge. You must make sure all the correct libraries are downloaded and in the correct place, so the commandline will work. By default the libraries are downloaded by the launcher, but not until you press play for the first time. A good way to make sure all the correct libraries are downloaded and in the correct spot, run the official launcher, download your version and press play. It will generate all the dependencies, then start your game. Now, close your game (unless you're having some sort of crashing issue, then just ignore), and run this command:



This was the last working commandline I established a few years back while working on a launcher. This is specifically for windows and the commandline is platform-dependent. You'll notice there is a few variables that need to get filled in.

Replace: + PCUser +
With: Your computers name. E.G Bryce-PC

Replace: + username +
With: Your Minecraft Username

Replace: + dir +
With: Your came root directory (default is the well known %appdata% path)

Replace: + client +
With: Your account UUID

Replace: + session +
With: The client token generated by the Mojang Session servers (https://wiki.vg/Authentication#Authenticate)
*Note: only required if you plan on connecting to servers

Replace: ANY 1.8.8
With: Your intended version of the game

Code:
java -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M -Dos.name=Windows10 -Dos.version=10.0 -Djava.library.path=C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\versions\1.8.8\natives -cp C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\17.0\guava-17.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\com\mojang\realms\1.7.39\realms-1.7.39.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\6.5\twitch-6.5.jar;C:\Users\" + PCUser + "\AppData\Roaming\.minecraft\versions\1.8.8\1.8.8.jar net.minecraft.client.main.Main --username " + username + " --version 1.8.8 --gameDir C:\Users\" + PCUser + "\AppData\Roaming\.minecraft --assetIndex 1.8 --uuid " + client + " --accessToken " + session + " --userProperties {} --userType mojang"


Hopefully I gave you enough to get a running start. It took some interesting methods to get this entire commandline put together.
Thank you so much, I appreciate it. I'll let you know what happens.
 

Bryce

Senior Java & Full-Stack Developer
Supreme
Feedback score
18
Posts
678
Reactions
934
Resources
19
Edit: Updated to show a more recent way to find the required Natives.

No problem.

Each version requires different libraries, or even the same libraries but different versions. ALL of these are downloaded in the /libraries folder. You need to ensure these are present.

You'll need to acquire the system natives too. You'll be able to find these in:

AppData/Local/Temp/XXXX-XXX-XXXXX
(Only while the game is running! This folder will delete when you close the game)

The X's will be random letters and numbers. You can easily search for "lwjgl64.dll" in your search bar to find the correct folder. Copy ALL the DLL's and move them to:

{gamedir}/versions/{version}/natives

For sake of example, and to help you further, I've attached a working version of 1.8.8 that I put together when I was neck deep in this project. It contains the 1.8.8 command line, libraries (for both windows and linux), and any other required files. This version will work right out of the box. It should help you follow the format so you can get later versions working on your own.

https://bryces.website/1.8.8.rar


*PS: If you are looking to have Minecraft Forge included with your launched game, There are a bunch of other required parameters & dependencies that forge requires on its own, alongside the other default requirements.
 
Last edited:

luaq

Supreme
Feedback score
7
Posts
141
Reactions
40
Resources
0
No problem.

The most difficult part you'll reach is making sure you acquire and move the right libraries into the right place.

Each version requires different libraries, or even the same libraries but different versions. ALL of these are downloaded in the /libraries folder.

You'll need to go into this folder, and pick out the libraries your version requires, and move them into

{gamedir}/versions/{version}/natives

For sake of example, and to help you further, I've attached a working version of 1.8.8 that I put together when I was neck deep in this project. It contains the 1.8.8 command line, libraries (for both windows and linux), and any other required files. This version will work right out of the box. It should help you follow the format so you can get later versions working on your own.

https://bryces.website/1.8.8.rar


*PS: If you are looking to have Minecraft Forge included with your launched game, There are a bunch of other required parameters & dependencies that forge requires on its own, alongside the other default requirements.
Alright, thanks. One other thing, I fail to understand the natives folder that is ideally there when I am developing a client but isn't when I export it. Where might the DLLs (natives folder) be stored with all of these versions if it appears to be a necessity?
 

Bryce

Senior Java & Full-Stack Developer
Supreme
Feedback score
18
Posts
678
Reactions
934
Resources
19
Edit: I've edited in a more modern, more complete solution into my second reply on this thread. Only use this post if you explicitly plan on using Legacy natives.


Alright, thanks. One other thing, I fail to understand the natives folder that is ideally there when I am developing a client but isn't when I export it. Where might the DLLs (natives folder) be stored with all of these versions if it appears to be a necessity?

See, that was an interesting problem I ran into as well. The way I acquired the DLL's was to use a legacy version of the Mojang Launcher.

When you use an older version of the launcher, after you press play, go to

{gameDir}/versions/{version}

The legacy launchers automatically create a folder called

natives-XXXXXXXXXXX

The X's being replaced with random numbers/letters

natives-82a7sd6a87sd6

This folder will dis-appear when you close the game however.


So basically, I used an old launcher, downloaded and pressed play. Once the game was open, I left it open, and went to the versions folder, copied the natives-XXXXXXXXXX and pasted it as just natives. Bam! All DLL's acquired.


In terms of the new launcher, I never put research into how to acquire these new DLL's
 
Last edited:

luaq

Supreme
Feedback score
7
Posts
141
Reactions
40
Resources
0
I got it to launch, I used the command from Bryce to accomplish it. I replace everything with the proper variables. I was getting an error for Unrecognized VM option 'CMSIncrementalMode', so I just removed the -XX:+CMSIncrementalMode argument. I also had to create a natives folder in the 1.8.8 folder and put the DLLs from my temp folder (found them through a quick Everything Search) into the natives folder. I ran it, and it was functional.
 

Bryce

Senior Java & Full-Stack Developer
Supreme
Feedback score
18
Posts
678
Reactions
934
Resources
19
I got it to launch, I used the command from Bryce to accomplish it. I replace everything with the proper variables. I was getting an error for Unrecognized VM option 'CMSIncrementalMode', so I just removed the -XX:+CMSIncrementalMode argument. I also had to create a natives folder in the 1.8.8 folder and put the DLLs from my temp folder (found them through a quick Everything Search) into the natives folder. I ran it, and it was functional.

This is useful information to those looking for the DLL's. I guess, you can use the old launcher to acquire them the same way I did, or, If you are using the current launcher, search in your Temp folder! (Just for them googlers, tryna archive these solutions for em)


Also, I am glad I was able to help you. I remember spending HOURS on this stuff trying to get it all figured out.
 
Status
This thread has been locked.
Top