public static Config load ( final String ... resources ) { final ScriptEngine engine = new ScriptEngineManager ( ) . getEngineByName ( "nashorn" ) ; try ( final InputStream resourceAsStream = findResource ( "jjs-config-utils.js" ) ) { engine . eval ( new InputStreamReader ( resourceAsStream ) ) ; loadResources ( engine , resources ) ; } catch ( final ScriptException se ) { throw new IllegalArgumentException ( "unable to execute main javascript." , se ) ; } catch ( final Exception ex ) { if ( ex instanceof IllegalArgumentException ) { throw ( IllegalArgumentException ) ex ; } throw new IllegalArgumentException ( "unable to load main resource " , ex ) ; } return loadFromObject ( engine . get ( "config" ) ) ; }
Loads a config file .