Java as scripting language can use both Beanshell and Groovy for JSR223 scripting (with minor restrictions/changes)
Java based (template engine) projects as Velocity have JSR223 support
Velocity can be integrated into the Java Scripting Language Framework (as defined by the JSR-223 API).
Freemarker suggest it in its contributors page
- javax.script (JSR-223) support
But when is it better to execute java based code through scripting? when it's better then executing it as a regular java code?