/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package proxki_server;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author static
*/
public class ExternalCommand {
//global variables
public final static String extCommand = "./usbRelay";
public void executeRelay() {
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec (extCommand);
//done executing command
//get the input stream from the subprocess
BufferedReader out = new BufferedReader( new InputStreamReader (process.getInputStream()));
String line = out.readLine();
while (line != null) {
System.out.println(line);
line = out.readLine();
}
}
catch (IOException e) {
System.out.println (e.toString());
}
}
}
|