0

I am trying to experiment a bit with JSch library in order to create a simple Java app that gets a remote shell.

I used this example as reference:

http://www.jcraft.com/jsch/examples/Shell.java.html

which works fine but autocompletion of commands is not supported.

I am executing my jar from cmd/Windows and the remote shell is a Linux machine. I don't get any error messages or warnings.

In the example it says something about lacking terminal-emulation. Is this maybe the issue? Any advice on how I can bypass this issue will be appreciated.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Thanasis B
  • 49
  • 9

1 Answers1

0

For autocompletion, you need to implement terminal emulation. It is not implemented by JSch.

See also Displaying Midnight Commander screen in JTextPane.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • I stripped down this example from swing library and tried it in windows cmd console, autocomplete did not work also in cmd. If I try to execute the example from a linux bash, striped from the swing version, will it work or in every case I need to implement terminal emulation ? Do you know maybe any other alternative library apart from Jsch that would have also terminal emulation? If not any advice on how to implement emulation? (example or some helpful link) Thank you very much for your answer and for your time – Thanasis B Nov 16 '19 at 21:01
  • That's too broad question. We do not know anything about your code. How it cooperates with the native OS terminal. And I probably would not be able to answer your question even them. + I do not know of any Java implementation of terminal emulation. + Implementing it on your own is probably not feasible. See my answer to [SSH.NET based colored terminal emulator](https://stackoverflow.com/q/44549443/850848). – Martin Prikryl Nov 16 '19 at 21:28
  • Thank you for providing more information on terminal emulation, it really helped me. To be more precise, do you know maybe another java library that provides ssh tunneling with terminal emulation support ? – Thanasis B Nov 17 '19 at 07:45
  • Sorry, but again, I do not know of *any* Java implementation of terminal emulation (let only implementation that also supports ssh tunneling). – Martin Prikryl Nov 17 '19 at 10:44
  • Your input was helpful enough to give me the proper investigation direction. If I manage to find another library with terminal emulation or if I manage to solve this issue using JSch I will post it here. Thank you for your contribution – Thanasis B Nov 17 '19 at 11:41