Hi,
i written class like this but it is not returning any results and infact p.waitFor() is returning value 1. This is very basic program that i am planning to run in unix. This is really killing my time and unable to find correct reason.
----------------------------------------------------------------------------------
import java.io.*;
public class myExecute {
public static void main(String[] args) throws IOException{
Process p=null;
String filename;
String cmd="/bin/touch -t 201412101053 /tmp/first && /bin/touch -t 201412101055 /tmp/last && /bin/find /opt/strms/NETEZZA_LOGS/mdo -type f -name retry.*.csv -newer /tmp/first ! -newer /tmp/last";
int i;
p = Runtime.getRuntime().exec(cmd);
System.out.println("Executed:"+cmd);
try {
if(p.waitFor()==0){
System.out.println("waitfor is over");
i=p.exitValue();
System.out.println(i);
InputStream is = p.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
while((filename=br.readLine())!=null){
System.out.println(filename);
}
}
else{
System.out.println(p.waitFor());
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
System.out.println(e.toString());
e.printStackTrace();
}
}
}
---------------------------------------------------------------
Appreciate for your help