Anthony
Anthony

Reputation: 113

GUI made for command line tool not responding

I am in the process of making a GUI in Javafx for a Java based command line tool the one of my predecessors had made. The command line tool is a 2 step tool, first you run the program using a specific set of configurations after which the command line input is required to quit out of the program or for additional analyses. I am using the following block of code to run the first half of the command-line tool:

        button = new Button("Run Proteinarium");
    button.setOnAction( e -> {System.out.println("Running Proteinarium");
    String command = "java -jar Proteinarium-master\\example\\Proteinarium.jar config=Proteinarium-master\\example\\config_SIM.txt";
    try {
        Process process = Runtime.getRuntime().exec(command);

        BufferedReader reader = new BufferedReader(
                new InputStreamReader(process.getInputStream()));
        String line;
        while ((line = reader.readLine()) != null) {
            System.out.println(line);
        }

        reader.close();

    } catch (IOException ex) {
        ex.printStackTrace();
    }

    }
    );

However, after click on the button while the first half of the command-line tool does run, the GUI stops responding. I believe this is likely due to the second-half of the command-line tool requiring additional input in the command Terminal. Any ideas for how to fix this?

I am running this on Windows 10.

Upvotes: 0

Views: 122

Answers (0)

Related Questions