Try cmd="/sbin/ifconfig \n"; -----Original Message----- From: Philippe Valle [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 2:31 PM To: Tomcat Users List Subject: getRuntime().exec(...) root command problem
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]