Results 1 to 6 of 6
- 10-05-2010, 02:15 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 27
- Rep Power
- 0
Save the output from system.out.println into a file
Hi all,
I am wondering if it is possible to save print outs from system.out.println into a file. I am using a third party code that outputs such prints, when I use it from command line I use: C:\\someCommand someOptions inputFile > outputFile
I don't want to mess about with the third party code, I just wonder whether I can implement something similar to ">" in the command line. In the Java code, I make an instance and call the run program of that instance with some parameters, so it just gives some printouts.
Thanks,
Iskatel.
- 10-05-2010, 02:21 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
the command line parameter can be found in the array of the main method :pJava Code:System.setOut(new PrintStream(new File("outputFile")));
- 10-05-2010, 02:27 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 27
- Rep Power
- 0
Hmm, thank you very much, I guess this should have gone to the beginners section :). I removed the main method and was using the class instance directly. Thank you again!
- 10-05-2010, 02:49 PM #4
Member
- Join Date
- Mar 2010
- Posts
- 27
- Rep Power
- 0
How do I set it back to normal? I tried System.setOut(System.out) doesn't work.
- 10-05-2010, 02:52 PM #5
Member
- Join Date
- Mar 2010
- Posts
- 27
- Rep Power
- 0
Done, should have saved it first PrintStrim ps = System.out; then System.setOut(ps).
Thanks.
- 10-05-2010, 02:52 PM #6
Member
- Join Date
- Mar 2010
- Posts
- 27
- Rep Power
- 0
Similar Threads
-
how to save output (from TextField) to a particular Folder as txt file
By doha786 in forum New To JavaReplies: 5Last Post: 08-03-2012, 10:47 AM -
System.out.println
By JohnDoe in forum New To JavaReplies: 1Last Post: 09-05-2010, 10:14 AM -
System.out.println(040|343);
By satheshshiva in forum New To JavaReplies: 5Last Post: 06-26-2010, 10:26 PM -
Println VS system.out.println
By ccie007 in forum New To JavaReplies: 2Last Post: 05-20-2010, 08:52 AM -
difference between system.out.println() & out.println()
By wickedrahul9 in forum Advanced JavaReplies: 5Last Post: 10-18-2008, 11:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks