Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a custom name laucher for Minecraft. I run an offline server and was wanting to give some of my friends a laucher to use so they can play. I have done this before with a batch file. Now I'm using JavaUI and I'm trying to start Minecraft from the Java program. I have yet to get Minecraft to pop up.

Here is the code i am using:

if (e.getSource() == app.startNorm){
    List<String> command = new ArrayList<String>();
    command.add(System.getenv("APPDATA") + "\\.minecraft\\bin\\* -Djava.library.path=\"" + System.getenv("APPDATA") + "\\.minecraft\\bin\\natives\" net.minecraft.client.Minecraft CustomNameHere");
        //line below wont work
        ProcessBuilder builder = new ProcessBuilder(command);
        Process proc = builder.start();
        app.setSize(500, 300);
        InputStream in = proc.getInputStream();
    } catch (IOException e1) {
        //always get dialog, when not never see minecraft pop up
        JOptionPane.showMessageDialog(null, "There was a problem with starting Minecraft");

I was hoping someone could show me how to get this, or any other way to lauch Minecraft from inside my program.

share|improve this question
Telling us which exception is thrown here would help. – Laurent Couvidou May 15 '12 at 17:58
up vote 4 down vote accepted

I made something similar in the past, here is the code i used:

Runtime rt = Runtime.getRuntime();                      
rt.exec("cmd /c java -jar filename.jar");


rt.exec("cmd /c filename.exe");
share|improve this answer
thanks very much – HcgRandon May 15 '12 at 23:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.