``` private ScriptEngine configureScriptEngine() { System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe"); System.setProperty("org.jruby.embed.localvariable.behavior", "transient"); ScriptEngine engine = factory.getScriptEngine(); try { String environment = "ENV['RUBYLIB']='" + config.rubyLib() + "'\n" + "ENV['GEM_HOME']='" + config.gemHome() + "'"; logger.error("Environment being set: {}", environment); engine.eval(environment); } catch (ScriptException e) { logger.error("Error setting environment", e); } return engine; } ```