JSR223 Scripting in Java

I’ve released Beta 2 of Java Scripting for openHAB to GitHub - weberjn/org.openhab.automation.javascripting .
It works similar to Groovy Scripting, only with Java as language.

Beta 2 supports Rules definitions with Java Annotations.

I’d be grateful if people test and play with Java Scripting.

There several samples in the README.

The previous discussion is here.

public class CronRule extends Script {

    private Logger logger = LoggerFactory.getLogger("org.openhab.automation.javascripting.cronrule");

    private int counter = 1;

    @Rule(name = "CronRule")
    @CronTrigger(id = "CronTrigger", cronExpression = "0 * * * * ?")
    public SimpleRule cronrule = new SimpleRule() {

        public Object execute(Action module, Map<String, ?> inputs) {

            logger.info("Java cronrule execute {}", counter++);

            return "";

    protected void onLoad() {
        logger.info("Java onLoad()");

Excellent ! I never had time to fully dive into your last iteration, but it always has been on my mind since then. I’m still very interested. I really like the fact that it is compliant with the JSR and all the openHAB facilities.
I will try to get some time to test it soon.

Thank you very much for your work.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.