Currently I'm trying to make my own front-end to GDB. Everything thus far is going swimmingly, except one part; piping input to the process, once it's been open. I'll include an example from my code below:
private JButton run = new JButton("Run");
JToolBar vertical = new JToolBar(JToolBar.VERTICAL);
vertical.add(run);
add(vertical, BorderLayout.WEST);
run.addActionListener(new ActionListner()
{
public void actionPerformed(ActionEvent arg0)
{
Process proc;
proc = Runtime.getRuntime().exec("gdb");
proc = Runtime.getRuntime().exec("r");
}
}
This would allow me to run the command 'gdb' and pipe all of it's output to my TextArea, but after that, the process closes and I can't run anymore commands such as 'r' to the same process, instead it opens another one and tries to execute the command 'r' on it's own; so is there any way for me to execute these in the same process? Also, because this will be a GUI, I'll need to have multiple buttons be able to interact with the same process, i.e. the button 'Run' needs to be able to execute 'r', while the button 'Breakpoint' needs to execute 'b' to the same process, is this possible?
TL;DR: Need to run multiple system commands from the same process in Java through the use of a GUI, is it possible?