title: How to connect the putty through Java code and pass command to terminal?
body: <p>I have tried with below code. but putty is launching and shuts imidiatlly. in command.txt contain ls -lrt code.</p>
  
  <pre><code>Runtime r = Runtime.getRuntime();
      //Runtime r2 = Runtime.getRuntime();
      Process p = null;
      //Process p2 = null;
      String s = "D:\\Nandan\\putty.exe -ssh -l ***** -pw ******** XX.XX.XX.XX -m D:\\Nandan\\command.txtx";
      //String s2 = "ls -lrt";
      try
      {
          p = r.exec(s);
          p.waitFor();
  
      } catch (Exception e)
      {
          System.out.println("Exception error :"+e.getMessage());
          e.printStackTrace();
      }
  </code></pre>