In the past I’ve used an XMLRPC server to allow URScript to call java functions, with the java side XMLRPC server implementation inspired by the following sample:
I have then opened a connection to that server in URScript and used that to call java methods in real time when required.