JLine only works from IDEA
Asked Answered
O

1

6

I have no problem using jline when the code is run within idea. Running with a bat file, the edit characters are not being sent to the terminal.

java -classpath ..\JActor\target\classes;..\JID\target\classes;target\classes;..\slf4j-api-1.7.2.jar;..\slf4j-simple-1.7.2.jar;..\apache-sshd-0.8.0\lib\sshd-core-0.8.0.jar;..\apache-sshd-0.8.0\lib\mina-core-2.0.5.jar;..\apache-sshd-0.8.0\lib\bcprov-jdk15-140.jar;..\jline-2.9.jar;..\joda-time-2.1.jar org.agilewiki.jasocket.sshd.SSHServer %1%

I checked the jline jar file and it contains the fusesource code for jansi and hawtjni.

Obie answered 19/1, 2013 at 14:5 Comment(15)
Is your terminal unicoded?Zizith
I'm using sshd to support remote access via PuTTY. I'm confused that running from IDEA would make a difference, though I get the sense that jline expect to be interacting with the local machine. So since I'm running from a windows command window, that might me an issue. Any way to force it?Obie
make an environment suitable to do IO in that caseZizith
Added to my code: System.out.println(t.isAnsiSupported()); System.out.println(t.isEchoEnabled()); System.out.println(t.isSupported()); got true/false/true on dos window and false/false/true in idea. environment? like, set a system property for the terminal type?Obie
Copy/paste command from idea console to windows cmd prompt didn't work?Zizith
Yes, sysprop file.encodingZizith
that copy/paste had no effectObie
then add -Dfile.encoding=UTF-8, or what encoding you have in IDEA?Zizith
I've tried jline.WindowsTerminal.ansi and jline.WindowsTerminal.directConsole to no availObie
using utf-8 in idea, setting that encoding when running java has no effectObie
check that System.getProperty in your code and compare.Zizith
are you running jline on the same machine?Zizith
how about user.language, and user.country?Zizith
yes! Only it looks like jline likes idea somehow. Now, I can force echo and local edits in putty and set the terminal type to none--that works. But that's not quite good enough for a product. :-/ And then I don't really need jline!Obie
do you have the same value for both props, because this props could be used in character streamsZizith
O
3

Turns out, the Terminal used under IDEA and the dos box were different. Forcing the use of the IDEA terminal in all cases didn't work, but this did:

    consoleReader = new ConsoleReader(in, out, new TerminalSupport(true) {});
Obie answered 20/1, 2013 at 3:34 Comment(1)
This same issue occurs when running from within Eclipse, and then later from within Tomcat. The given fix works, although I still don't understand why even though I've been looking through the JLine2 code.Fogbow

© 2022 - 2024 — McMap. All rights reserved.