This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Applets and the fly likes Run the command ipconfig through an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "Run the command ipconfig through an applet" Watch "Run the command ipconfig through an applet" New topic
Author

Run the command ipconfig through an applet

Mario Cageggi
Greenhorn

Joined: Apr 22, 2009
Posts: 8
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
Marshal

Joined: Mar 22, 2005
Posts: 35252
    
    7
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.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Run the command ipconfig through an applet
 
Similar Threads
Strange problem with Runtime.exec()
Process hanging
How to Run DOS Commands( ipconfig /All >> a.txt)
How can I execute "ipconfig /all" from applet?
get IP, but not 127.0.0.1