String[] cmd = new String[4]; String soundOpt = new String("0"); String fullScrOpt = new String("0"); cmd[0] = "/usr/X11R6/bin/fceu"; //btnSoundOn is a JRadioButton if (btnSoundOn.isSelected()) { soundOpt = "1"; cmd[1] = "-soundq 1 -soundvol 500"; //up the quality and volume } cmd[1] = "-sound " + soundOpt; //btnFullScrOn is a JRadioButton if (btnFullScrOn.isSelected()) { fullScrOpt = "1"; } cmd[2] = cmd[2] + "-fs " + fullScrOpt; cmd[3] = gameSelected; Runtime rtObj = Runtime.getRuntime(); try { rtObj.exec(cmd); } catch (IOException i) { System.out.println("IOException: " + i.getMessage()); i.printStackTrace(); }