mort mort - 3 months ago 32x
Java Question

Launch Minecraft from command line - usename and password as prefix

I'm trying to make a simple custom Minecraft launcher thing.

According to minecraft wiki's Launcher page:,
it should be possible to run the minecraft launcher using username and password as prefix from the command line, and go directly to the game instead of through the launcher.

I've tried various versions of

java -cp -u=username -p=password minecraft.jar net.minecraft.LauncherFrame
, and what it says is the old method:

java -cp minecraft.jar net.minecraft.LauncherFrame <username> <password>

The old method opens the minecraft launcher, just as if I double clicked the jar file. It does not go directly to the menu screen.

The new way, using password and username as prefix, just give me an error message saying the
prefix -u=username or -p=password don't exist

Any help on this? I'm really stuck :/


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:

java -Xms512m -Xmx1g -Djava.library.path=natives/ -cp "minecraft.jar;lwjgl.jar;lwjgl_util.jar" net.minecraft.client.Minecraft <username> <sessionID>

Set the working directory to .minecraft/bin.

To get the session ID, POST (request this page):<username>&password=<password>&version=13

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 in C#, and an example of launching minecraft.jar.