Executing the shell script through java program

Hi Team,

Can you pls advise in java how can we call a shell script, actly I have a shell script at the following location

/opt/dd/ajh.sh

now I can execute this script by opening the session through putty by entering the servers details and password and then navigating to the following location.....

opt/dd/ajh.sh

and then exceutig this script ajh.sh start
this script requires an additional parameter 'start' now lets say if my server details are

userid is XXX
PASSWORD is YYY

now please advise through java program How can I call this script .

Note - that server details like userid and password can be harcoded in java class in string string itself.

By example, google for more...

Runtime r = Runtime.getRuntime(); 
Process p = r.exec("uname -a"); 
p.waitFor(); 
BufferedReader b = new BufferedReader(new InputStreamReader(p.getInputStream())); 
String line = "";  
while ((line = b.readLine()) != null) {   
System.out.println(line); 
}  
b.Close();

Hi blackrageous ,

Thanks for the reply , but my major concerns is that java program should first establish he connection with server first how it will make ssh connection first and then it will execute that script , please advise