getRuntime().exec(...) root command problem 2004-01-16 - By Philippe Valle
Back
I want do do ipconfig on linux with exec java command. When i do 'ls' for exemple is ok , but for root command like 'ifconfig' i have nothing .
my code : ................... cmd="ls -l\n"; try { Process p=Runtime.getRuntime().exec("/bin/sh"); OutputStream in=p.getOutputStream(); in.write(cmd.getBytes()); in.flush(); InputStream out=new BufferedInputStream(p.getInputStream()); byte[] b=new byte[1024]; int n=out.read(b); for(i=0;i<n;i++) System.out.print((char)b[i]);
} catch(Exception ex) { } .....................
I want just get MAC ADDRESS of my network device , there is another way to do that ?
Thanks.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
|
|