Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Run the command ipconfig through an applet

 
Mario Cageggi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I am trying to execute the "ipconfig /all" command through an applet; I try to execute exactly these lines:

private final static String windowsRunIpConfigCommand() throws IOException {
Process p = Runtime.getRuntime().exec("ipconfig /all");
InputStream stdoutStream = new BufferedInputStream(p.getInputStream());

StringBuffer buffer= new StringBuffer();
for (;;) {
int c = stdoutStream.read();
if (c == -1) break;
buffer.append((char)c);
}
String outputText = buffer.toString();

stdoutStream.close();

return outputText;
}

but it not working...

Is it something wrong?
May it be that I cannot run a command like "ipconfig /all" in an applet due to security restriction?

Thanks!
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, applets can't use Runtime.exec within the sandbox. There are most likely exceptions to this effect in the Java Console. See HowCanAnAppletReadFilesOnTheLocalFileSystem how to work around this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic