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

My script (ECMA) In OpenHAB 3.1.0M2 on Windows 10 looks like this:

var exec = Java.type("org.openhab.core.model.script.actions.Exec");
exec.executeCommandLine(Duration.ofSeconds(5),'command'))

The script execution bombs out with:

[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID '54e9adb988' failed: ReferenceError: "Duration" is not defined in <eval> at line number 15'

Suggestions? (didn’t work in 3.0.0 either)

You’ll need to import Duration too.

var Duration = Java.type("java.time.Duration");

Thanks. That fixed the duration problem.

So now no matter what I put for a command, the log shows Failed to execute commandLine 'whatever command'. The command is valid and works if you just copy/paste into a windows command line. Any other tricks up your sleeve?

Not for Windows.

If only we knew what the secret command was, what syntax you were using.
Bear in mind the command line is running in a windowed shell, but the exec is not.