# Usage of new ECMA2021 Automation Scripting (GraalVM)

**URL:** <https://community.openhab.org/t/usage-of-new-ecma2021-automation-scripting-graalvm/122724>\
**Category:** Scripts & Rules\
**Created:** [May 23, 2021, 10:50pm UTC](https://community.openhab.org/t/usage-of-new-ecma2021-automation-scripting-graalvm/122724 "2021-05-23T22:50:55Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![moonraker](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@moonraker](https://community.openhab.org/u/moonraker)\
**Post date:** [May 27, 2021, 6:31pm UTC](https://community.openhab.org/t/usage-of-new-ecma2021-automation-scripting-graalvm/122724/13 "2021-05-27T18:31:22Z")

</div>

@jpg0 I got it now to run, things I did:

1. Installed ohj-support Add-on from [https://github.com/jpg0/oh-config/files/5745369/org.openhab.automation.ohj-support-3.0.0-SNAPSHOT.jar.zip](https://github.com/jpg0/oh-config/files/5745369/org.openhab.automation.ohj-support-3.0.0-SNAPSHOT.jar.zip)
2. A fresh git clone of [GitHub - jpg0/ohj: Openhab Javascript Library](https://github.com/jpg0/ohj) into “/etc/openhab/automation/lib/javascript/community”
3. Changed the mentioned function “lookupService” to the fixed one [Testing the GraalJS package with OH3 · Issue #2 · jpg0/oh-config · GitHub](https://github.com/jpg0/oh-config/issues/2#issuecomment-751525800)

After a restart it worked.

What I am wondering is that I do have to use always relative paths for loading the ohj package via require:

```javascript
const { item, sendIt } = require("../../../lib/javascript/community/ohj/fluent/fluent");
const ohj = require("./../../../lib/javascript/community/ohj");
const LOG = ohj.log("second");
const fluent = ohj.fluent;

with (fluent) {
    when(cron("0/30 * * * * ?")).then(sendOff().toItem("RemoteopenHABServerPROD_ItemSFStudioLichtDecke"));
}

```

When I am going through your personal git repo you always use “…require(‘ohj’);”.

Why is that not working on my setup?

Also I am wondering if there is something like the “event.itemState” property like it is available in the definition of “classic” oh scripters ECMA5 rules (when using JSRule with ohj)?

Thank you very much for your help!

---

_[View the full topic](https://community.openhab.org/t/usage-of-new-ecma2021-automation-scripting-graalvm/122724)._
