简体   繁体   中英

Java remote access a linux machine from windows machine

I have a windows machine which connects to a remote Linux machine where my Java program is running. How could I run a command for example, "free -m" in the remote linux machine and collects data in the windows machine. Any strategy?

You can execute Linux command from java program remotely using Jsch and expect4j .
For example, look at this question .

You can use ssh user@host free -m . Just get some ssh client for windows. I personally prefer cygwin which will also give you a nice way to script it using bash.

如果您使用jsch以外的任何方式,则有遭受亵渎的风险:)

I have previously used Trilead SSH which was great and simple to use. Unfortunately Trilead don't support it anymore, however according to this site (lots of SSH links there) the ex-Trilead version is now here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM