简体   繁体   中英

Running a command line on a remote server

I have a command (actually it is a Hadoop job command like) "hadoop jar " that needs to be run on a server whose ip address I know.

How can I invoke the command from inside my java code?

Thanks Abhishek S

Implement additional two applications, the first runs on the server and launches your command, the second runs on the client side and sends commands to the server via network socket connection. Server app receives client request and runs required command line on the server host.

To execute a command on the local host (for server-side application), use Runtime class and its exec() method.

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