1

I have an issue where I am trying to use my previous knowledge of programming to write a Minecraft launcher. I have use of commands that are in the standard C++ libraries and any Python eggs that are not huge. I would prefer to use system("java ...") in order to launch Minecraft.

The question in short: How do I launch Minecraft from the command line without any auxillary Java code? (Without using launcher code like net.minecraft.LauncherFrame) Is it possible? I tried java -cp mine craft.jar net.minecraft.client.Minecraft from the Terminal in Mac OS X, to no avail, ending with a ClassNotFoundException.

Can anyone shed some light on my problem? Thank you, Pyro.

PyroAVR
  • 719
  • 1
  • 8
  • 19
  • 1
    Try changing the terminal part to java -jar minecraft.jar net.minecraft.client.Minecraft – supersam654 Jan 31 '13 at 03:36
  • I managed to run minecraft from command line using this: java.exe -cp minecraft.jar;lwjgl.jar;lwjgl_util.jar;jinput.jar ^ -Djava.library.path=natives net.minecraft.client.Minecraft "%INPUT%" --noupdate – weggo Jan 31 '13 at 06:12
  • Hmm, neither of those suggestions seem to have worked. I tried both to no avail. It might help to say that I am running a Mac.... Not sure if that is helpful. – PyroAVR Jan 31 '13 at 21:01

1 Answers1

1

I'm running on linux, but this also should work for you:

java -cp ".minecraft/bin/*" -Djava.library.path=".minecraft/bin/natives/" net.minecraft.client.Minecraft "username" "login id"

You don't need to input your username/login id, but if you don't, you can't get in any servers.

You can get your login id here: https://login.minecraft.net?user=<username>&password=<password>&version=13

More info about the authentication scheme here

UPDATE:
The new launcher for minecraft 1.6 changed a lot.
For the launch command you should look in .minecraft/versions/<version>/<version>.json The authentication also changed. It now uses POST parameters and returns JSON. More about it here.

mid_kid
  • 1,460
  • 2
  • 13
  • 15
  • You, sir, are a genius. Thank you so much! Where did you find that wiki page, by the way? What did you search? – PyroAVR Feb 24 '13 at 04:04
  • I've been interested in the minecraft protocol a while. i searched [this](http://bit.ly/WlzQ6N). – mid_kid Feb 25 '13 at 08:35
  • just for clarification purposes, the `https://login.minecraft.net` returns a string separated into 5 parts by collens (assuming you used the right username and password). the fourth part is the login id. – QxQ Apr 15 '13 at 03:48
  • you have to run the command `java -cp ...` at your home directory. – QxQ Apr 15 '13 at 04:09
  • @QxQ The link i added on the post explains everything you just said and changing the paths to the jars is pretty straightforward. – mid_kid Apr 19 '13 at 09:07
  • Like it says above: Look in the file: `.minecraft/versions//.json` (or [here](http://s3.amazonaws.com/Minecraft.Download/versions/1.7.4/1.7.4.json)). On that file you can read how minecraft is launched, what libraries it uses, etc... Basically, you need to change the -cp option to point to **Every. Single. Library**, extract the natives manually and change the library path, change `net.minecraft.client.Minecraft` to whatever main class your version is using, and instead of adding the user and password at the end, use the arguments in `minecraftArguments`. – mid_kid Jan 06 '14 at 18:37