diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 1f5790b79..e093e3a94 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -3482,6 +3482,27 @@ public class PApplet implements PConstants { } + /** + * Pass a set of arguments directly to the command line. Uses Java's + * Runtime.exec() + * method. This is different from the launch() + * method, which uses the operating system's launcher to open the files. + * It's always a good idea to use a full path to the executable here. + *
+ * exec("/usr/bin/say", "-v", "Pipe Organ", "welcome to the command line");
+ *
+ * Or if you want to wait until it's completed, something like this:
+ *
+ * Process p = exec("/usr/bin/say", "waiting until done");
+ * try {
+ * int result = p.waitFor();
+ * println("the process returned " + result);
+ * } catch (InterruptedException e) { }
+ *
+ * You can also get the system output and error streams from the Process
+ * object, but that's more that we'd like to cover here.
+ * @return a Process object
+ */
static public Process exec(String... args) {
try {
return Runtime.getRuntime().exec(args);