title: Command in Runtime.getRuntime().exec not working
body: <p>I have a java file named <code>MemoryComparison.java</code> kept in the folder <code>D:\Documents\CodeAnalysis\project_analysis_RG\CodeAnalysis\input\master\Kajari_G</code></p>
  
  <p>I have another folder <code>D:\Documents\CodeAnalysis\output\</code> where I want to store the output of the above java file after execution.</p>
  
  <p>In the Java program MemoryComparison.java I have not given any package name.</p>
  
  <p>Now, I am compiling and executing the above java program from another java program named <code>ReadFilesInFolders.java</code>. Below is the code snippet:</p>
  
  <pre><code>try {
      Runtime.getRuntime().exec("javac input\\master\\Kajari_G\\MemoryComparison.java");
      Runtime.getRuntime().exec("java -cp input\\master\\Kajari_G\\ MemoryComparison &gt; output\\output1.txt");
       } catch (IOException e) {
      e.printStackTrace();
       }
  </code></pre>
  
  <p>Now, the first exec is working fine and the .class file is getting generated in the same folder, where MemoryComparison.java is. But it seems the second exec is not working as no output1.txt is getting created. </p>
  
  <p>But when I am running the above two lines from the command prompt, everything is working fine and the output1.txt is getting created.</p>
  
  <p>Can you please help me with this!</p>