MrAppleseed 0 Newbie Poster

Hey all,

I'm currently somewhat new to Java, but not to programming, so I appologize if there's an obvious way to do this. Anyway, I'm currently writing a peice of code that I hope will be a graphical front end to GDB because I hate all the other front-ends, it seemed fairly easy, yet challenging enough to push me, and I dislike using GDB from the command line (personal preferance). Anywho, I got most of my issues ironed out, except the whole, inputing to GDB part. I can currently get GDB to run, or any othere bash command, but once GDB is running, I can no longer input to it. It seems as though the process I created closes right after I issue one command, which is the opposite of what I want happening... Anywho, hope there's an easy fix! My code is as below, oh and thanks for your help! :)

package com.gdb;


import com.gui.Window;
import com.gui.newCommand;

public class IO implements Runnable{
    private int lineNumber = 1;

    public Runnable runner = new Runnable()
        public void run()
                Window.lineNumber = 1;
                File file = new File("/");
                Process p = null;
                Runtime r = Runtime.getRuntime();

                p = r.exec("bash -c " + newCommand.customCommand, null, file);
                if(p != null)
                    BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
                    String line = reader.readLine();
                    while(line != null)
                        Window.textArea.append(Window.lineNumber + ": " + line + "\n");
                        line = reader.readLine();
            }catch(IOException e1) {
                Window.textArea.append(e1.toString() + "\n");

    public void run() {
        // TODO Auto-generated method stub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.