/ Published in: Java
WARNING: Don't use this one lightly, you can run just about any command the JVM has access to and could corrupt data or bring your system crashing to a halt. Certainly do not recommend putting this behind a user-accessible front-end such as a Web Form, Servlet or GUI control without intense scrutiny, validation and filtering of the inputs.
Expand |
Embed | Plain Text
import java.io.*; /** * ExecuteSystemCommand.java * Runs any command from the Operating System command-line. */ public class ExecuteSystemCommand { public void ExecuteSystemCommand() { } String line; try { while ((line = input.readLine()) != null) { output += (line + '\n'); } input.close(); } ex.printStackTrace(); } return output; } ExecuteSystemCommand cmd = new ExecuteSystemCommand(); //CAREFUL HERE!!!!!!!!!!! } }
You need to login to post a comment.
