ReferenceError: "executeCommandLine" is not defined in <eval>

  • Platform information:
    • Hardware: Raspberry with Openhabian
    • OS: Openhabian
    • openHAB version: 3.2
  • Issue of the topic: Receive always referenceError: “executeCommandLine” is not defined in

I always receive ReferenceError: "executeCommandLine" is not defined in <eval> when running a simple


What is the problem here? Rights of the file are correct, running via console is possible etc.

What rules language?

Both. With application/javascript I receive the error. With application/vnd.openhab.dsl.rule nothing happens.

I also tried now the following with DSL

executeCommandLine(Duration.ofSeconds(1), "/home/pi/")

and the following with javascript

var Exec = Java.type("org.openhab.core.model.script.actions.Exec");
Exec.executeCommandLine(Duration.ofSeconds(1), "/home/pi/");

With this nothing happens when using DSL or javascript. Also no warning in events.log. How can I debug further?

Found the problem, was at the end related to my script which requires an additional variable if run by console directly vs. via script.

For others which are having similar problems and who want to debug the issue further below the final script which I used to identify the problem as the result is shown in the events.log

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.switcherStatus');
var Exec = Java.type("org.openhab.core.model.script.actions.Exec");
var response = Exec.executeCommandLine(Duration.ofSeconds(1), "/home/pi/");"gotResult:" + response);
1 Like