title: Obtain input and output of Java program through bash
body: <p>I have a java Program which accepts inputs and prints outputs based on the input provided by the user. For example, when I run it, the program prompts the user:</p>
  
  <pre><code>System Starts  
  
  login &lt;--- User input
  
  Login Successful 
  </code></pre>
  
  <p>I want to be able to run the program through bash and save the output of the program to a text file.</p>
  
  <p>This is what I tried:</p>
  
  <pre><code>echo "login" | javac TicketSystem/src/*.java &gt; Output.txt
  </code></pre>
  
  <p>But when I do this, my <code>Output.txt</code> file remains empty. I want the <code>Output.txt</code> file to contain:</p>
  
  <pre><code>Login Successful
  </code></pre>
  
  <p>Is this possible?  </p>