//NOTE: new javax.script.EngineManager() uses context class loader
//We've changed that to use EngineManager(ClassLoader loader)
//Alternatively, we could instantiate it in a separate thread with proper context class loader set.
//TODO: not sure wether resources are correctly freed. A running script will probably keep running, for example, if it has got threads
//but that would hang the console, which is quite primitive yet. (it would need a 'run [script] &' idiom)
console = new Console(new JMXEngineContext("javascript", new OSGiScriptEngineManager(context)));
Thread t=new Thread(console);
//At least JRuby engine (maybe others too) uses context class loaders internally
//So this is to prevent problems with that: context cl=console class loader which in turn
//loads the manager and therefore engine factory
// t.setContextClassLoader(this.getClass().getClassLoader());