How to execute multiple unix commands in one session from java

Hi,

Iam trying to code in java and wanted to run the commands in the Unix remote servers. I have the following code to run multiple GREP commands in a single session.
But when i execute this, the first command executes successfully, whereas from the next line it says
"Exception Occured
java.io.IOException: A remote execution has already started."

Following is my code snippet :

[LEFT]FileReader fr = new FileReader("grepcommands.txt");
BufferedReader br = new BufferedReader(fr);
String inputscript="";
sess= conn.openSession();
while((inputscript=br.readLine())!=null){
sess.execCommand(inputscript);[/LEFT]
}

sess.close();

It would be great if anyone can provide me the solution for this.

Would this logic work?

FileReader fr =
new FileReader("grepcommands.txt");
BufferedReader br = new BufferedReader(fr);
String inputscript="";
String allscript = "";
sess= conn.openSession();
while((inputscript=br.readLine())!=null){
allscript.append(inputscript + ";")
}

sess.execCommand(allscript);

sess.close();

Explaination:
Multiple execution can be done in sequence when given with semicolon ";"
cmd1; cmd2; cmd3; cmd4

My assumption is exeCommand executes the commands as shell does...