Issue2427

classification
Title: jython --boot cannot load console support on Windows
Type: Severity: normal
Components: Versions: Jython 2.7
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eaaltonen, jeff.allen, zyasoft
Priority: low Keywords:

Created on 2015-11-12.16:17:23 by eaaltonen, last changed 2018-03-05.21:44:17 by jeff.allen.

Messages
msg10464 (view) Author: (eaaltonen) Date: 2015-11-12.16:17:22
Jython startup is slowish, so I tried `jython --boot` resulting in the following:

$ jython --boot
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.internal.Kernel32
        at org.fusesource.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport.java:50)
        at org.python.jline.WindowsTerminal.getConsoleMode(WindowsTerminal.java:204)
        at org.python.jline.WindowsTerminal.init(WindowsTerminal.java:82)
        at org.python.jline.TerminalFactory.create(TerminalFactory.java:101)
        at org.python.jline.TerminalFactory.get(TerminalFactory.java:158)
        at org.python.jline.console.ConsoleReader.<init>(ConsoleReader.java:229)
        at org.python.util.JLineConsole.install(JLineConsole.java:107)
        at org.python.core.Py.installConsole(Py.java:1517)
        at org.python.core.PySystemState.initConsole(PySystemState.java:1200)
        at org.python.core.PySystemState.doInitialize(PySystemState.java:1060)
        at org.python.core.PySystemState.initialize(PySystemState.java:974)
        at org.python.core.PySystemState.initialize(PySystemState.java:930)
        at org.python.core.PySystemState.initialize(PySystemState.java:925)
        at org.python.util.jython.run(jython.java:263)
        at org.python.util.jython.main(jython.java:142)
msg10469 (view) Author: (eaaltonen) Date: 2015-11-13.11:10:23
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_67
Type "help", "copyright", "credits" or "license" for more information.
>>>
msg10470 (view) Author: Jim Baker (zyasoft) Date: 2015-11-13.23:06:54
This seems to be a general problem on Windows. Likely this is because the Jansi library depends on a DLL for its functionality when run on Windows, and the way it loads up the DLL is incompatible with Jython being on the bootpath.

Presumably we need to disable attempting using the bootpath for Jython on Windows; or if we do allow it, to disable readline support.
msg11745 (view) Author: Jeff Allen (jeff.allen) Date: 2018-03-05.21:44:17
JLine extracts a copy of the jansi DLL to temporary storage (twice for some reason -- see #2589).

In 2.7.2a1 we get:
PS> jython --boot
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no jansi in java.library.path]
        at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)
        at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)
        at org.fusesource.jansi.internal.CLibrary.<clinit>(CLibrary.java:42)
        at org.fusesource.jansi.AnsiConsole.wrapOutputStream(AnsiConsole.java:48)
         ...

Clearly we are here: https://github.com/fusesource/hawtjni/blob/84aa381836dae2b784ea685b71c54c6eb6622646/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java#L224 but I'm not much the wiser.
History
Date User Action Args
2018-03-05 21:44:17jeff.allensetpriority: low
nosy: + jeff.allen
messages: + msg11745
milestone: Jython 2.7.2 ->
2016-02-08 15:53:21zyasoftsetmilestone: Jython 2.7.2
2016-01-15 15:31:42zyasoftsettitle: jython --boot throws error on Windows 7 -> jython --boot cannot load console support on Windows
2015-11-13 23:06:54zyasoftsetnosy: + zyasoft
messages: + msg10470
2015-11-13 11:10:24eaaltonensetmessages: + msg10469
2015-11-12 16:17:23eaaltonencreate