Java-as-Script provides a hot reloading JSR-223 implementation for Java
Clone or download
Pull request Compare This branch is 177 commits ahead of jmarranz:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build: Circle CI


Java-as-Script Alpha

Java-as-Script provides a hot reloading JSR-223 implementation for Java. This version is a fork of the original project specifically it has been reduced in scope to focus entirely on the JSR-223 aspect of the original project. It is also primarily been forked for use in the Dollar project.

Make sure you have the JCenter repo in your pom.xml


Then just add the following dependency



Below is a complete example of using Java-as-Script as a JSR-223 scripting engine, with the language being Java.

package com.sillelien.jas;

import com.sillelien.jas.jproxy.JProxy;
import com.sillelien.jas.jproxy.JProxyConfig;
import com.sillelien.jas.jproxy.JProxyScriptEngine;
import com.sillelien.jas.jproxy.JProxyScriptEngineFactory;

import javax.script.Bindings;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.util.Collections;
import java.util.List;

public class Demo {

    public static void main(String[] ignored) throws Exception {

        //Initializing and configuring the JSR-223 script engine
        JProxyConfig jpConfig = JProxy.createJProxyConfig();
            .setRelProxyOnReloadListener((objOld, objNew, proxy, method, args) -> {
            //                .setInputPath(".")
            .setJProxyDiagnosticsListener(diagnostics -> {
                List<Diagnostic<? extends JavaFileObject>> diagnosticList = diagnostics.getDiagnostics();
                    .filter(diagnostic -> diagnostic.getKind().equals(Diagnostic.Kind.ERROR))

        JProxyScriptEngineFactory factory = JProxyScriptEngineFactory.create();

        ScriptEngineManager manager = new ScriptEngineManager();
        manager.registerEngineName("java", factory);
        Bindings bindings = manager.getBindings();
        bindings.put("in", "World");

        ScriptEngine engine = manager.getEngineByName("java");
        JProxyScriptEngine scriptEngine = (JProxyScriptEngine) engine;

        //Your code goes here, e.g.

        scriptEngine.eval("System.out.println(\"Hello \"+context.getAttribute(\"in\",javax.script.ScriptContext.ENGINE_SCOPE));return null;\n",bindings);


Dependencies: Dependency Status

** If you use this project please consider giving us a star on GitHub. **

Please contact me through Gitter (chat) or through GitHub Issues.

GitHub Issues Join the chat at

For commercial support please contact me directly.