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:
System Starts
login <--- User input
Login Successful
I want to be able to run the program through bash and save the output of the program to a text file.
This is what I tried:
echo "login" | javac TicketSystem/src/*.java > Output.txt
But when I do this, my Output.txt file remains empty. I want the Output.txt file to contain:
Login Successful
Is this possible?
javachow you run it when it prompts you for login normally?javacor not, I thought that's what I need to do to run the java program. When I run the program using javac however, I don't see anything on the screen, that is only what is shown in Eclipsejavacis a java compiler not a java runner.