Index: registry
===================================================================
--- registry (revision 6256)
+++ registry (working copy)
@@ -30,11 +30,13 @@
# this option is set from the command line.
#python.verbose = message
+# Jython ships with a JLine console (http://jline.sourceforge.net/) out of the box.
# Setting this to the name of different console class, new console
-# features can be enabled. Readline support is such an example
-#python.console=org.python.util.JLineConsole
+# features can be enabled. Readline support is such an example:
#python.console=org.python.util.ReadlineConsole
#python.console.readlinelib=JavaReadline
+# To activate the legacy Jython console:
+#python.console=org.python.util.InteractiveConsole
# Setting this to a valid codec name will cause the console to use a
# different encoding when reading commands from the console.
Index: src/org/python/util/jython.java
===================================================================
--- src/org/python/util/jython.java (revision 6250)
+++ src/org/python/util/jython.java (working copy)
@@ -308,15 +308,23 @@
/**
* Returns a new python interpreter using the InteractiveConsole subclass from the
* python.console registry key.
+ *
+ * Default is {@link JLineConsole}
*/
private static InteractiveConsole newInterpreter() {
- try {
- String interpClass = PySystemState.registry.getProperty("python.console",
- "org.python.util.InteractiveConsole");
- return (InteractiveConsole)Class.forName(interpClass).newInstance();
- } catch (Throwable t) {
- return new InteractiveConsole();
+ InteractiveConsole interactiveConsole = null;
+ String interpClass = PySystemState.registry.getProperty("python.console", "");
+ if (interpClass.length() > 0) {
+ try {
+ interactiveConsole = (InteractiveConsole)Class.forName(interpClass).newInstance();
+ } catch (Throwable t) {
+ // ok to fail, e.g. NoClassDefFoundError
+ }
}
+ if (interactiveConsole == null) {
+ interactiveConsole = new JLineConsole();
+ }
+ return interactiveConsole;
}
/**