开发者

Executing batch file on remote system using Java

How to execute a batch file located on Windows remote system? Batch fil开发者_C百科e should run on remote system.


Abhinav, For your problem I see RMI is the quickest possible solution

  1. Check out the basics from these links (1,2)
  2. Start the server from where you want to run the batch
  3. In the Remote object on the server side Use Runtime.getRuntime().exec() to run your batch.
  4. From the client machine give call to this remote object and method.


Another approach is to use SSH like sshj. This only requires the remote system to have SSH installed and is more secure than RMI.


You can use Jsch and Expect4j for executing commands on remote machine(window/Linux). Further more, if your system allows, transfer the batch file on remote machine using some FTP utility like Apache Commons Net and then execute commands that executes the script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜