How do I connect to Unix server using java program and run a Unix command?

Thảo Justin

New member
How do I connect to Unix server using java program and run a Unix command?
Answer
JSch jsch = new JSch(); String command = “
/tmp/myscript.sh “; Session session = jsch. getSession(user, host, 22); session. connect(); Channel channel = session. openChannel(“exec”); ((ChannelExec)channel).
 

Tìm kiếm

Back
Top