at the moment I use Beanshell to write application extensions. I just use BshMethod.invoke() to integrate it with the java application.
Could this be done with JShell too? Load a script and execute a method in the script? Via a JShell API, not via cmdline...