title: Pass String as params from one Java App to another
body: <p>I'm trying to pass String as parameter from one Java Aplications to second as StartUp parameter</p>
  
  <p>for example I have Aplications that must call start another Java Aplication (just contains only JOptionPane, JDialog or simple JFrame) before <code>System.exit(0);</code>, there I trying to send some descriptions from closing application to another, </p>
  
  <p>these code is simulations what I tried that and in this form, code works correctly and displayed String into the JTextArea ...</p>
  
  <pre><code>    import java.io.IOException;
      import java.util.concurrent.*;
  
      public class TestScheduler {
  
          public static void main(String[] args) throws InterruptedException {
              ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10);
              executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(true);
              executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(true);
              for (int i = 0; i &lt; 10; i++) {
                  final int j = i;
                  System.out.println("assign : " + i);
                  ScheduledFuture&lt;?&gt; future = executor.schedule(new Runnable() {
  
                      @Override
                      public void run() {
                          System.out.println("run : " + j);
                      }
                  }, 2, TimeUnit.SECONDS);
              }
              System.out.println("executor.shutdown() ....");
              executor.shutdown();
              executor.awaitTermination(10, TimeUnit.SECONDS);
              try {
                  Process p = Runtime.getRuntime().exec("cmd /c start java -jar C:\\Dialog.jar 'Passed info'");
              } catch (IOException ex) {
                  ex.printStackTrace();
              }
              System.out.println("System.exit(0) .....");
              System.exit(0);
          }
  
          private TestScheduler() {
          }
      }
  
  //
  import java.awt.*;
  import java.util.ArrayList;
  import javax.swing.*;
  
  public class Main {
  
      private static ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
  
      public Main() {
          JFrame frm = new JFrame();
          JTextArea text = new JTextArea();
          if (list.size() &gt; 0) {
              for (int i = 0; i &lt; list.size(); ++i) {
                  text.append(list.get(i));
              }
          }
          JScrollPane scroll = new JScrollPane(text,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frm.add(scroll, BorderLayout.CENTER);
          frm.setLocation(150, 100);
          frm.setSize(new Dimension(400, 300));
          frm.setVisible(true);
      }
  
      public static void main(String[] args) {
          if (args.length &gt; 0) {
              for (String s : args) {
                  list.add(s);
                  System.out.print(s + " ");
              }
          }
          Main m = new Main();
      }
  } 
  </code></pre>
  
  <p>my question :  </p>
  
  <p>EDIT1: if is there exist another way how to pass some value from one Java Aplication (there must be called System.exit(0);) to another Java Aplication, another way as I tried by using Process/ProcessBuilder</p>
  
  <p>EDIT2: my crosspost <a href="http://forums.oracle.com/forums/thread.jspa?threadID=2229798&amp;tstart=0" rel="nofollow">http://forums.oracle.com/forums/thread.jspa?threadID=2229798&amp;tstart=0</a></p>
  
  <p>accepted answer from OTN</p>