Java Command Prompt Exit
<p>I have a short question concerning the Runtime.getRuntime.exec("") command in java.</p>

<p>I am trying to make a tunnel to a gateway computer via SSH:</p>

<pre><code>String tunnel = "C:\\Program Files\\PuTTY\\putty.exe -ssh -X -P " + localPort + " " + tempUsername + "@" + localIP
                    + " -pw " + tempPassword + " -L " + tunnelPort + ":" + gatewayName + ":"+gatewayPort;

Runtime.getRuntime().exec(tunnel);
</code></pre>

<p>This bit of code works properly except the annoying fact that a command prompt appears.</p>

<p>Now I tried to exit the prompt after executing the code:</p>

<pre><code>String tunnel = "C:\\Program Files\\PuTTY\\putty.exe -ssh -X -P " + localPort + " " + tempUsername + "@" + localIP
                    + " -pw " + tempPassword + " -L " + tunnelPort + ":" + gatewayName + ":"+gatewayPort;

String cmdCommands [] = {tunnel, "exit"};

Runtime.getRuntime().exec(cmdCommands);
</code></pre>

<p>Is it possible to close the command prompt in a similar way like I do or are there better ways? (This code doesnt work)</p>
