I'm working on a biology project that requires me to run little apps from java. The code below was borrowed and works 99% of the time. I send it a command which it executes like typing it into command line. The problem here is that this program requires text input. In linux, if i type in "wine protdist.exe < protdist" where protdist is a text file with the input (in this case, only "y" then carriage returns), the program runs and I get output. If I use the code below, it will execute wine protdist.exe, but I cant for the life of me pass the program the few characters that I need for it to move on. Any suggestions on how I can execute this program. send it a character and a carriage return and more on? TIA
File dirFile = new File(tempDir); String[] cmd = new String[1]; cmd = "wine protdist.exe < protdist"; deleteFile(tempDir + "outfile"); Process coffee = null; Runtime runtime = null; try { coffee = runtime.getRuntime().exec(cmd, null, dirFile); } catch (IOException e) { e.printStackTrace(); System.out.println("OMG FAIL!"); } InputStream is = coffee.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; deleteFile(tempDir + "testOuput.txt"); TextIO.writeFile(tempDir + "testOutput.txt"); try{ while ((line = br.readLine()) != null) { TextIO.putln(line); } } catch (IOException e) {System.out.println("fail");} //System.out.println("Program terminated!");