Java Redirecting Input and Output Stream of Terminal to GUI (JSch)

别说谁变了你拦得住时间么 提交于 2019-12-08 07:47:13

问题


I'm working on a project in which I intend to make a Java GUI application that connects to a ssh server and executes remote commands on the server. I'm willing to use JSch Library. My aim is to make buttons and textfields those will provide the user the ability of sending commands and getting replies easily. I mean, instead of opening xShell and prompting "grep "hi" /usr/file.txt", the user will choose the path from the list and will enter "hi" into the textfield and will press the button for grep.

Problem is, I couldn't find a solution to redirect inputstream so that i could send the arguments those shall be taken from related GUI components.

Since I have not made so much modifications on the JSch's example code, yet, you can see the code here: http://www.jcraft.com/jsch/examples/Exec.java.html

Thanks from now on.

来源:https://stackoverflow.com/questions/29485164/java-redirecting-input-and-output-stream-of-terminal-to-gui-jsch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!