Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » I cant redirect the output to a file
I cant redirect the output to a file [message #1168944] Sun, 03 November 2013 17:50 Go to next message
Borja Molina Zea is currently offline Borja Molina ZeaFriend
Messages: 2
Registered: November 2013
Junior Member
Hi, I configure eclipse in order to the output of the console goes to a text file

Run Configurations -> Common -> Standar Input and Output --> select the box 'file'

but It doesnt works Sad the output file is always blank
Re: I cant redirect the output to a file [message #1171202 is a reply to message #1168944] Tue, 05 November 2013 04:41 Go to previous messageGo to next message
shankha banerjee is currently offline shankha banerjeeFriend
Messages: 40
Registered: February 2013
I was able to direct the output of a hello word application to a file.

Are you running the program as Java application or eclipse application.
Try running it as eclipse java application.

Re: I cant redirect the output to a file [message #1178052 is a reply to message #1168944] Sat, 09 November 2013 10:53 Go to previous message
Arnav Kumar is currently offline Arnav KumarFriend
Messages: 16
Registered: October 2013
Junior Member
Try this to print output file

public class SOPinTxtFile {	
private void writeFile(){		
System.out.println("hello ji from method");
public static void main(String[] args) {
try {
System.setOut(new PrintStream("c:\\output.txt"));
} catch (FileNotFoundException e) {
System.out.println("From main");
new SOPinTxtFile().writeFile();
int a=10,b=10;		
System.out.println("Division is "+a/b);

You may use log4j for this puropose.

[Updated on: Sat, 09 November 2013 10:56]

Report message to a moderator

Previous Topic:Servise
Next Topic:Why is Javadoc view always blank? How to read Java API in Eclipse?
Goto Forum:

Current Time: Tue May 22 02:50:47 GMT 2018

Powered by FUDForum. Page generated in 0.01423 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top