Hello Madan ,
The following solution is platform dependent
public class TestMath
public static void setWrite()
{
// java -Djava.security.policy=allpolicy.policy com.superiorpharm.TestMath
try
{
if( System.getSecurityManager() == null )
System.setSecurityManager(new SecurityManager());
SecurityManager s = System.getSecurityManager() ;
if( s != null )
s.checkExec("dir") ;
//Process p = Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE") ;
System.out.println("Executing the process...");
// if it's windows
Process p = Runtime.getRuntime().exec("c:\\winnt\\system32\\attrib -r t.txt") ;
System.out.println("After Executing the process...");
InputStream ee = p.getInputStream() ;
int readInt = ee.read() ;
while( readInt != -1 )
{
System.out.print((char) readInt );
readInt = ee.read() ;
if( readInt == -1 )
break ;
}
ee = p.getErrorStream() ;
readInt = ee.read() ;
while( readInt != -1 )
{
System.out.print((char) readInt );
readInt = ee.read() ;
if( readInt == -1 )
break ;
}
System.exit(0);
}
catch(IOException e)
{
System.out.println("Unable to start the process " + e) ;
}
}
public static void main(
String a[]) throws RxbException
{
TestMath.setWrite();
}
}