tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Valle <pva...@eprocess.fr>
Subject getRuntime().exec(...) root command problem
Date Fri, 16 Jan 2004 09:00:56 GMT


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@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message