Java Runtime.getRuntime().exec not returning any value

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

Make sure the command you are attempting to run is a valid shell command. Test this at the command line before running from code.

/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

i have tested this command before putting in code. it is running fine

First, you need to read both stdout and stderr streams from the process before you call waitFor(). If you don't, your child process could block/hang or even fail to run at all as it's output can't go anywhere. How do you read two streams and then call waitFor()? Multiple threads is the way I've seen it done most often.

Second, typing a command in an interactive shell isn't necessarily the same as running it as a subprocess. You may need to escape your "!" character in your Java string.

What's your operating system?

I kept it simple and was able to run this code without error after I substituted CMD for something simpler like ls so it could very well be that you may need to quote special characters. The first thing that stood out to me in your program is the complexity of what you are shelling.

And that does not address why the original code failed.

I think problem is in &&. if i just given "cat /tmp/ss.txt" then it is able to read and i am getting results back. but if i execute multiple commands by separating && then it is not working.