Fixed build, compile errors, removed warnings

Also, the Nashorn engine is now retrieved from
NashornScriptEngineFactory