run linux command from java and reading result?

import java.*;
class Test {

public static void main(String[] args) {
int ch;
try {
Process myProcess = Runtime.getRuntime().exec(“ls -al”);
InputStreamReader myIStreamReader = new InputStreamReader(myProcess.getInputStream());
while ((ch = myIStreamReader.read()) != -1) {
System.out.print((char) ch);
}
} catch (IOException anIOException) {
System.out.println(anIOException);
}
}
}

Advertisements

About lorddisk

WebCenter Content, WebCenter Portal, WebCenter Sites,Weblogic, Identity and Access Management (IAM),SSO,OAM,OIM,OAAM,OUD, OPAM,OID, OVD ,Oracle API Gateway ,OBIEE,OEDQ, Oracle ADF, Oracle SOA,J2EE, CackePHP ,PHP,J2SE,J2EE,Spring,Hibernate,JQuery,CSS,Java Script ,Joomla,Drupal,Worpress
This entry was posted in java, mysql. Bookmark the permalink.