Package org.forester.util
Class SystemCommandExecutor
java.lang.Object
org.forester.util.SystemCommandExecutor
-
Constructor Summary
ConstructorDescriptionSystemCommandExecutor
(List<String> command_information) Pass in the system command you want to run as a List of Strings, as shown here: Listcommands = new ArrayList (); commands.add("/sbin/ping"); commands.add("-c"); commands.add("5"); commands.add("www.google.com"); SystemCommandExecutor commandExecutor = new SystemCommandExecutor(commands); commandExecutor.executeCommand(); Note: I've removed the other constructor that was here to support executing the sudo command. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the standard error (stderr) from the command you just exec'd.Get the standard output (stdout) from the command you just exec'd.static boolean
isExecuteableFile
(File path_to_cmd_f)
-
Constructor Details
-
SystemCommandExecutor
Pass in the system command you want to run as a List of Strings, as shown here: Listcommands = new ArrayList (); commands.add("/sbin/ping"); commands.add("-c"); commands.add("5"); commands.add("www.google.com"); SystemCommandExecutor commandExecutor = new SystemCommandExecutor(commands); commandExecutor.executeCommand(); Note: I've removed the other constructor that was here to support executing the sudo command. I'll add that back in when I get the sudo command working to the point where it won't hang when the given password is wrong. - Parameters:
command_information
- The command you want to run.
-
-
Method Details
-
isExecuteableFile
-
executeCommand
- Throws:
IOException
InterruptedException
-
getStandardErrorFromCommand
Get the standard error (stderr) from the command you just exec'd. -
getStandardOutputFromCommand
Get the standard output (stdout) from the command you just exec'd.
-