How to open linux terminal from java and be able to execute commands in it? -


i want write program connects remote machines via ssh , install predefined software. wanna make process of installing clear users make visible users. have faced problems: how open terminal java , send commands it?(outputstream doesn't work) how execute command in terminal when ssh? want run local scripts on remote machine , allow user? interact terminal, when script running (for example accept licence of software , on).

i trying not working.

    runtime runtime = runtime.getruntime();     process process = runtime.exec("x-terminal-emulator -e ./script.sh"); 

in theory possible. you'll need java library, such jsch, interact directly terminal via ssh, , make use of screen utility share single terminal screen between java prog , user.

from java prog:

screen -d -m -s shared screen -rx shared <type installation commands> 

from remote user:

screen -rx shared 

of course remote user must wait until java prog initializes screen in order attach it.

please note kinds of things can go wrong when let users interact screen. program must smart enough handle it.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -