# Cannot run a JavaScript code in a Script Task

**URL:** <https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742>\
**Category:** Flowable Engine\
**Created:** [December 15, 2021, 12:42pm UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742 "2021-12-15T12:42:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![joaofmonteiro](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@joaofmonteiro](https://forum.flowable.org/u/joaofmonteiro)\
**Post date:** [December 15, 2021, 12:42pm UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/1 "2021-12-15T12:42:52Z")

</div>

Hi,

I’m testing the trial version of the enterprise subscription of Flowable (v3.10.3), and I’m facing issues using the Script Task within a process.  
I selected “JavaScript” for the Script format, and tried to run a simple script ( var test =1; ), but an error keeps occurring when I run the process on flowable work.

![imagem flowable](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/5/5012bea5099f4f1e5be6b0a1312e5141a5155c3a.jpeg)

I get this error: " Can’t find scripting engine for ‘javascript’ "

Can anyone please help? 🙁

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![maudrid](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@maudrid](https://forum.flowable.org/u/maudrid)\
**Post date:** [December 17, 2021, 11:41am UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/2 "2021-12-17T11:41:00Z")

</div>

This could be related to the java version that you are using.  
I think Nashorn (the javascript engine in java) has been deprecated in later versions.  
[https://openjdk.java.net/jeps/335](https://openjdk.java.net/jeps/335)

---

<div class="post-metadata">

**Author:** ![joaofmonteiro](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@joaofmonteiro](https://forum.flowable.org/u/joaofmonteiro)\
**Post date:** [December 20, 2021, 3:45pm UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/3 "2021-12-20T15:45:44Z")

</div>

Thank you @maudrid  
I was able to solve my issue with your help. 😀

---

<div class="post-metadata">

**Author:** ![jarahbe32](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jarahbe32](https://forum.flowable.org/u/jarahbe32)\
**Post date:** [March 10, 2022, 6:06pm UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/4 "2022-03-10T18:06:39Z")

</div>

hello , I’m new at coding  
I’m soo confused about these codes, I’m just put some wrong codes and it’s not working well , can you give me any tips for it

---

<div class="post-metadata">

**Author:** ![jarahbe32](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jarahbe32](https://forum.flowable.org/u/jarahbe32)\
**Post date:** [March 24, 2022, 9:10am UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/5 "2022-03-24T09:10:51Z")

</div>

Same issue[.](https://panoramacharter.ltd/)  
[.](https://19216811.bid/default-router-ip-addresses/)

---

<div class="post-metadata">

**Author:** ![ramisthand76](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ramisthand76](https://forum.flowable.org/u/ramisthand76)\
**Post date:** [March 25, 2022, 8:22am UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/6 "2022-03-25T08:22:47Z")

</div>

i got same issue. and i don’t know how to solve this

---

<div class="post-metadata">

**Author:** ![ramisthand76](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ramisthand76](https://forum.flowable.org/u/ramisthand76)\
**Post date:** [April 19, 2022, 8:39am UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/7 "2022-04-19T08:39:20Z")

</div>

i don’t know how to solve this[.](https://myfiosgateway.one/)[.](https://tutuappvip.co/mobdro-download)

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [August 17, 2022, 8:58am UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/8 "2022-08-17T08:58:08Z")

</div>

Hey everyone,

For everyone that does not understand how to solve this and why the problem is there. Starting from Java 15 the Javascript Nashorn engine has been removed from the JDK [JEP 372: Remove the Nashorn JavaScript Engine](https://openjdk.org/jeps/372).

If you want to keep using Javascript you will need to manually add [Maven Central Repository Search](https://search.maven.org/artifact/org.openjdk.nashorn/nashorn-core).

Cheers,  
Filip

---

<div class="post-metadata">

**Author:** ![carbon\_60](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@carbon\_60](https://forum.flowable.org/u/carbon_60)\
**Post date:** [July 11, 2023, 12:40am UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/9 "2023-07-11T00:40:44Z")

</div>

Not sure what dependencies I have to add in order for script task to work in Java 17. I added

```
implementation 'org.openjdk.nashorn:nashorn-core:15.4'

```

to my build.gradle file, but script task is still not working. My script task is very simple like this

execution.setVariable(“errorStatus”, “timeout”);

This script task worked fine in Java 11.

So I suspect additional dependencies are missing in addition to nashorn-core

---

<div class="post-metadata">

**Author:** ![carbon\_60](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@carbon\_60](https://forum.flowable.org/u/carbon_60)\
**Post date:** [July 11, 2023, 12:20pm UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/10 "2023-07-11T12:20:15Z")

</div>

Well, I rolled back to Java 11, it still fails. This was working last time I tested, and my script task has not changed, but apparently something has changed. The only thing I changed was to upgrade to java 17, at least that is what I thought. I do not see any errors in the log, so this becomes a black box to me. Is that a way to see what errors in my script task?

---

<div class="post-metadata">

**Author:** ![carbon\_60](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@carbon\_60](https://forum.flowable.org/u/carbon_60)\
**Post date:** [July 11, 2023, 6:26pm UTC](https://forum.flowable.org/t/cannot-run-a-javascript-code-in-a-script-task/8742/11 "2023-07-11T18:26:44Z")

</div>

It turns out there are two issues here.

One is that the String in the script has to be in single quote even though the JavaScript standard allows either single or double quotes.

The second issue is that the script task does not seem to execute if it is right after a boundary timeout event. I asked the second issue here [Script task does not execute after boundary timeout event](https://forum.flowable.org/t/script-task-does-not-execute-after-boundary-timeout-event/10676).
