ConsoleManager conMgr = (ConsoleManager) InitialNaming .lookup(ConsoleManager.NAME);
final ShellManager sm = InitialNaming.lookup(ShellManager.NAME); final ConsoleManager conMgr = sm.getCurrentShell().getConsole().getManager();
    private static Toolkit createInstance() {        try {            ConsoleManager conMgr = (ConsoleManager) InitialNaming                    .lookup(ConsoleManager.NAME);            final TextConsole console = (TextConsole) conMgr                    .createConsole("charva", ConsoleManager.CreateOptions.TEXT);            console.addKeyboardListener(new KeyboardAdapter() {                public void keyPressed(KeyboardEvent event) {                    if (event.isControlDown() && event.getKeyChar() == 'z') {                        System.err                                .println("got ctrl-z, unregistering Toolkit.");                        //maybe this will help to debug the finite-sized text                        // area bug.                        instance.unregister();                        event.consume();                    }                }            });            Toolkit tk = new Toolkit(console, conMgr);            return tk;        } catch (NameNotFoundException e) {            throw new RuntimeException(e);        }    }