# Run a Processing sketch from Node-RED

**URL:** <https://discourse.processing.org/t/run-a-processing-sketch-from-node-red/12939>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [July 24, 2019, 12:04am UTC](https://discourse.processing.org/t/run-a-processing-sketch-from-node-red/12939 "2019-07-24T00:04:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nallasiger](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@nallasiger](https://discourse.processing.org/u/nallasiger)\
**Post date:** [July 24, 2019, 12:04am UTC](https://discourse.processing.org/t/run-a-processing-sketch-from-node-red/12939/1 "2019-07-24T00:04:15Z")

</div>

Hello,

**I’d like to see if anyone can help me run a specific Processing sketch through a [Node-RED](https://discourse.nodered.org/) user interface.** I’m building a connected desk lamp and would like to be able to change its light patterns from my phone.

I can’t use GPIO pins since designating a specific sketch requires more than a high/low output… what I think I need is some way to specify a string value which can be read into the Pi.

So I thought I could use an exec node to not only pass the string, but to also run the program at the same time.

 ![2019-07-22-211815_800x480_scrot](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a54a29b72805d08e69dc0a9bb6bd63f931d22cce.png)

The above image shows a bash file that I created later on, but originally, I put the following command in a bash file and tried to run it:

**processing-java --sketch=/home/pi/Digital-lava-lamp/StartupArraySweep --run**

The command works perfectly in the Pi’s terminal but when I try to execute it through Node-RED I get the following error.

 ![node_red_error](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/885bb524b4669349f595442b791b44c052a3efaa.png)

I’ve tried to work around this a number of ways, but the same error occurs each time. Here’s everything that I’ve tried so far.

- Running the above os.system command as is
- Adding the above command to a bash file, then running the bash file
- Adding the above command to a Python script, and calling it using os.system
- Checking the msg.payload box in exec node
- Unchecking the msg.payload box in exec node

So does anybody have any suggestions on what I should try next?? I can’t decipher the error to be able to fix it. If anyone can explain what’s wrong here, or maybe an alternate way to accomplish my goal, I’d be very grateful. Thanks.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [July 28, 2019, 5:46pm UTC](https://discourse.processing.org/t/run-a-processing-sketch-from-node-red/12939/2 "2019-07-28T17:46:30Z")

</div>

Were you able to resolve?

Possibly related to your problem:

- [https://forum.processing.org/two/discussion/22844/exception-in-thread-awt-eventqueue-0-java-awt-headlessexception](https://forum.processing.org/two/discussion/22844/exception-in-thread-awt-eventqueue-0-java-awt-headlessexception)
