If the remote machine is a Unix machine with a running SSH daemon you can use SSH to execute the command. There are enough
Java SSH solutions around the Internet, Google can help you with those.
If it's a Windows machine perhaps RPC or something similar can help you, but that's outside my scope of knowledge.
Raghavan: a Socket can help you if you have your own program / service running on the remote machine with a ServerSocket listening for requests, but otherwise you would need to connect with another service that allows command execution. There aren't many of those.