Interact with linux, send command to shell

edited September 2015 in Questions about Code

Hello everyone, I' new on Processing I have a Python background and I need to find a function to execute a command on Shell.

For example I build a GUI with some buttons and each button send a command to the system OS.

Is that possible?

Thanks for help


  • edited September 2015 doesnt work :(

    void mousePressed() {
     String[] params = {"rdesktop" };
     exec(params);  //with open() the output is -- The function "Open(string[])" does not exist. --

    My output is Cannot run program "rdesktop": error=2, File or directory does not exist
        at java.lang.ProcessBuilder.start(
        at java.lang.Runtime.exec(
        at java.lang.Runtime.exec(
        at processing.core.PApplet.exec(
        at sketch_150903a.mousePressed(
        at processing.core.PApplet.mousePressed(
        at processing.core.PApplet.handleMouseEvent(
        at processing.core.PApplet.dequeueEvents(
        at processing.core.PApplet.handleDraw(
        at processing.awt.PSurfaceAWT$12.callDraw(
        at processing.core.PSurfaceNone$
    Caused by: error=2, File or directory does not exist
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(
        at java.lang.ProcessImpl.start(
        at java.lang.ProcessBuilder.start(
        ... 10 more


  • This is the reference for exec():

    It's of extreme importance mentioning which Processing series/version being used!
    Since there's a huge chasm among them! [-(

Sign In or Register to comment.