# Execute an exernal .jar file, the best way

**URL:** <https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149>\
**Category:** General\
**Created:** [22 January 2019 20:22 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149 "2019-01-22T20:22:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [22 January 2019 20:22 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/1 "2019-01-22T20:22:34Z")

</div>

Hi everyone, I hope you can clear me the best way, my knownledge of Linux and Node Red is limited, thank you.  
I have Sunricher dimmers, I've found a "bridge" via mqtt (thanks to the author for this) and I need to execute the command by console: java -jar /home/pi/sunricher/sunricher-mqtt-2.0.2-jar-with-dependencies.jar  
I need to start it automatically, every startup..  
Well, I suppose is possible to fine a way to execute it at every startup, scripting something on boot files, but I would know if there are also other ways. Scripting boot will not let me see the ouput in the console, if it works and is connected, there is any way to start it inside the NodeRed flow and see the output too?

I hope in future I'll have anough skills to create a Node Red module from its sources.. (hopefully the author will agree too)  
Thanks for help

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [22 January 2019 21:49 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/2 "2019-01-22T21:49:02Z")

</div>

sorry for my newbie questions, I think console is important for debugging, if I start Node Red automatically and not by an SSH shell how and I see after its ouput?  
Thank you

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 January 2019 21:50 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/3 "2019-01-22T21:50:37Z")

</div>

automatically... = how ? what platform ? what OS ? how exactly are you starting it ?

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [22 January 2019 22:36 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/4 "2019-01-22T22:36:24Z")

</div>

Thank you for kind reply! Raspberry3, Raspbian, I just follower the instruction after lunching from SSH the node-red-start, I executed that command and now it starts itself after reboot.  
Possible to see the console?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 January 2019 23:06 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/5 "2019-01-22T23:06:30Z")

</div>

> [@GiovanniG](#):
>
> Possible to see the console?

Run `node-red-log` to see the log output. Note that is a command only available as part of the Raspberry Pi install - it is not a general command that works on other platforms.

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [23 January 2019 06:48 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/6 "2019-01-23T06:48:39Z")

</div>

Thnak you, may you please suggest me also (if there is) an alternative way to run a .jar file than put it on boot script? Maybe possible to start from node red and catch its console logs?  
Thank you!

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [23 January 2019 07:01 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/7 "2019-01-23T07:01:08Z")

</div>

Have a look at the Exec node. There is also node-red-node-daemon in the catalog.

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [23 January 2019 13:00 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/8 "2019-01-23T13:00:26Z")

</div>

thank you for kind reply, it works, the problem is when I edit the flow and deploy again, I need to terminate the last execution and restart process again. I have to avoid to load it twice. How this is possible?  
Is it possible when I press deploy to upload new flow to terminate the execution of previous process? Thank you

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [23 January 2019 13:02 UTC](https://discourse.nodered.org/t/execute-an-exernal-jar-file-the-best-way/7149/9 "2019-01-23T13:02:29Z")

</div>

The exec node should automatically kill any child process it has started when you redeploy.
