Hey all
I want to be able to use system calls in Linux using Java - I know you can use something like the following:
Code:
import java.io.*;
import java.util.*;
import java.lang.*;
public class getFileSeperator{
public static void main(String[] args) {
try{
Runtime aRT = Runtime.getRuntime(); //Runtime.getRuntime();
//Spawn a shell sub-process
Process aProc = aRT.exec("//sbin//ifconfig -a");
BufferedReader kbdInput = new BufferedReader(new InputStreamReader(aProc.getInputStream()));
String line;
while((line = kbdInput.readLine()) !=null)
System.out.println(line);
}catch(IOException ex) {
System.out.println("ExeNativeCmd.execInUnix:error");
};
}
}
But what if I want to have a seperate argument:
i.e.
Code:
String arg1 = "-a";
String arg2 = "eth0;
Process aProc = aRT.exec("//sbin//ifconfig" + arg1);
This doesn't seem to work for me