Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Applets and the fly likes Run the command ipconfig through an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Applets
Bookmark "Run the command ipconfig through an applet" Watch "Run the command ipconfig through an applet" New topic

Run the command ipconfig through an applet

Mario Cageggi

Joined: Apr 22, 2009
Posts: 8

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 =;
if (c == -1) break;
String outputText = buffer.toString();


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?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Run the command ipconfig through an applet
It's not a secret anymore!