package com.github.atomfrede.jadenticon;

import org.apache.commons.io.FileUtils;

import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.File;

public class JdenticonWrapper {

    private Object jdenticon;
    private Invocable invocable;

    public JdenticonWrapper() {

        try {
            ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
            ScriptEngine nashorn = scriptEngineManager.getEngineByName("nashorn");

            invocable = (Invocable) nashorn;

            String script = FileUtils.readFileToString(new File(getClass().getResource("/jdenticon.js").toURI()));
            nashorn.eval(script);

            jdenticon = nashorn.eval("jdenticon");
        } catch (Exception e) {

            throw new RuntimeException("Unable to setup nashorn and jdenticon script.", e);
        }

    }

    public String getSvg(Jadenticon jadenticon) {

        try {
            return (String) invocable.invokeMethod(jdenticon, "toSvg", jadenticon.hash, jadenticon.size, jadenticon.padding);
        } catch (ScriptException | NoSuchMethodException e) {

            throw new RuntimeException("Unable to create jdenticon svg.", e);
        }

    }
}

@@ -74,16 +74,54 @@
 leUtils;
+%0Aimport org.apache.commons.io.IOUtils;
 %0A%0Aimport
@@ -277,16 +277,44 @@
 io.File;
+%0Aimport java.io.InputStream;
 %0A%0Apublic
@@ -678,60 +678,35 @@
     
-String script = FileUtils.readFileToString(new File(
+InputStream scriptStream = 
 getC
@@ -723,16 +723,24 @@
 Resource
+AsStream
 (%22/jdent
@@ -752,17 +752,67 @@
 js%22)
-.toURI())
+;%0A            String script = IOUtils.toString(scriptStream
 );%0A 

Use getResourceAsStream as getResource won't work