Search code examples
javafiledirectoryminecraftlauncher

Run Minecraft Launcher through a Java Program in a different directory?


I am making a program in Java that involves me starting up the Minecraft launcher through the program itself. I've seen a way to do this using ProcessBuilders and stuff like that. However, I do not want the launcher to run to the default minecraft folder directory (minecraft on mac, .minecraft on windows). Is there a way that I can run the launcher through my program with the files set towards a different directory?


Solution

  • With the following command line you can make the new launcher use another directory:

    minecraftLauncher.exe --workDir path/to/your/other/minecraft

    The path can contain shortcuts, like %appdata% or %homepath%, etc.