Well it sure works for me using Groovy and the library in my hello-world-lib repo.
E.g. I created the following test.groovy file:
import com.acme.*;
HelloWorld.log();
HelloWorld.print();
PinguinSay.log("I just came by to say that using a Java library in your openHAB rules is very easy once the code is part of an OSGi bundle!");
PinguinSay.print("I just came by to say that using a Java library in your openHAB rules is very easy once the code is part of an OSGi bundle!");
When I save the file it prints/logs โHello World!โ using the library and there is even a penguin talking to me!
openhab> log:set info com.acme.PinguinSay
openhab> log:set info com.acme.HelloWorld
openhab> log:tail
20:12:37.779 [INFO ] [hab.core.service.AbstractWatchService] - Loading script '/home/wouter/software/openhab/instance/conf/automation/jsr223/test.groovy'
20:12:37.787 [INFO ] [com.acme.HelloWorld ] - Hello World!
Hello World!
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - _________________________________________
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - / I just came by to say that using a Java \
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - | library in your openHAB rules is very |
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - | easy once the code is part of an OSGi |
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - \ bundle! /
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - -----------------------------------------
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - \
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - \
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - .--.
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - |o_o |
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - |:_/ |
20:12:37.788 [INFO ] [com.acme.PinguinSay ] - // \ \
20:12:37.789 [INFO ] [com.acme.PinguinSay ] - (| | )
20:12:37.789 [INFO ] [com.acme.PinguinSay ] - /'\_ _/`\
20:12:37.789 [INFO ] [com.acme.PinguinSay ] - \___)=(___/
_________________________________________
/ I just came by to say that using a Java \
| library in your openHAB rules is very |
| easy once the code is part of an OSGi |
\ bundle! /
-----------------------------------------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/