Hello,
I am trying to run tshark command using runtime environment in
java on ubuntu . My code is as follows :-
try {
String destip = map1.get((String) innObj.get("value"));
Runtime run = Runtime.getRuntime();
String tshk = "/usr/bin/tshark -r /home/pratibha/Desktop/vox.pcap -Y \"ip.dst == "
+ destip
+ " && http\" -T fields -e tcp.port -e col.Info";
Process pr = run.exec(tshk);
int exitcode = pr.waitFor();
System.out.println(exitcode);
BufferedReader buf = new BufferedReader(
new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line = buf.readLine()) != null) {
System.out.println(line);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
map1 is hashmap which contains the destination ip adress
When i run the above code the exit code for process (pr) is 1 and hence the tshark command is not executing properly.
Please help