title: Send Commands remotely from Windows to Linux through Java
body: <p><p>I searched everywhere but can't find a solution that works. 
  <p> I have a Linux Debian machine in my network, which is running as a Mqtt Broker. I want to write a java programm to send sub and pub commands to the broker from another computer (Windows). Is there a way to send Linux commands from a Windows Computer?
  <p> If yes, is it possible to do it through java code and recieve the proper outputs?</p>
  
  <p><p> I tried the following:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.InputStreamReader;
  
  public class AA
  {
      public static void main(String[] args) throws Exception
      {
          ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c",
                  "ssh 10.20.0.30 -l username"); // Ip of the Mqtt Broker
          builder.redirectErrorStream(true);
          Process p = builder.start();
          BufferedReader r = new BufferedReader(
                  new InputStreamReader(p.getInputStream()));
          String line;
          while (true)
          {
              line = r.readLine();
              if (line == null)
              {
                  break;
              }
              System.out.println(line);
          }
      }
  }
  </code></pre>
  
  <p>The output is: </p>
  
  <blockquote>
    <p>Pseudo-terminal will not be allocated because stdin is not a terminal.</p>
  </blockquote>
  
  <p><p> I feel like this might work, if the right commands would be added.
  <p> I have heard of libraries like "Eclipse Paho", but I want to know if my solution can work.
  <p> Thanks in advance!</p>