Redirect or capture eclipse console output to text file
There are situations where we need to capture or redirect the eclipse console to a text file, so later we can refer to the output.
- Write a java program as usual in eclipse.
- While on the program screen, click on Run -> Run Configurations…
- Navigate to “Common” tab
- Check “File:” and “Append” box and enter the file path and apply
- Run the java test as usual, check the file at specified path…
Console content will be captured to the text file.
By using Java program we can achieve the same with below statement,
System.setOut(new PrintStream(new FileOutputStream("c:\output.txt")));
Find the output.txt file under your C:\ drive.
Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!