title: Start native terminal with command arguments (Java)
body: <p>I have a seemingly trivial problem: I want to start a terminal from a java process and give the terminal one or two commands.
  I have a simple example code, that works perfectly on windows with CMD. But I have not been able to achieve the same exact behavior on a Linux nor a Mac OS machine.
  I am aware, that the command needs to be changed, but unfortunately I have not been able to pass a string of arguments to a terminal on Mac.</p>
  
  <p>Here the working code for windows:</p>
  
  <pre><code>import java.lang.ProcessBuilder.Redirect;
  
  public class ExecTest {
      public static void main(String[] args){ 
          String cmd = "cmd /c start cmd.exe /K \"echo hello &amp;&amp; echo bye\"";
          try {
              Process p = Runtime.getRuntime().exec(cmd);
              p.waitFor();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>On lubuntu I have been able to create a terminal with this command:</p>
  
  <pre><code>lxterminal -l -e 'echo hello &amp;&amp; echo bye &amp;&amp; read'
  </code></pre>
  
  <p>But this only works if called by a terminal but not with the java process.</p>
  
  <p>.  </p>
  
  <p><strong>TLDR</strong>: What is the Linux and Mac equivalent of this command:</p>
  
  <pre><code>cmd /c start cmd.exe /K \"echo hello &amp;&amp; echo bye\"
  </code></pre>