Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to write my output to a text file :( ?

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Thanked 0 Times in 0 Posts

    Unhappy How to write my output to a text file :( ?

    Hi everyone,

    I have this code given, and I would like to put my output of this code into a text file. Can anyone help me do that?? thanks in advance.

    The code is this:

    import java.net.*;
    import java.io.*;

    public class URLReader {
    public static void main(String[] args) throws Exception {

    URL oracle = new URL("http://www.oracle.com/");
    BufferedReader in = new BufferedReader(
    new InputStreamReader(oracle.openStream()));

    String inputLine;
    while ((inputLine = in.readLine()) != null)

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 632 Times in 540 Posts

    Default Re: How to write my output to a text file :( ?

    Recommended reading: Lesson: Basic I/O (The Java™ Tutorials > Essential Classes)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Writing to output text file
    By gatorsgirl in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: May 13th, 2012, 08:17 PM
  2. Using bufferedReader to write contents of text file into an object array.
    By aznenginerd in forum What's Wrong With My Code?
    Replies: 9
    Last Post: May 8th, 2012, 02:13 PM
  3. Replies: 0
    Last Post: December 15th, 2011, 12:14 PM
  4. write text to a file help
    By wolfgar in forum File I/O & Other I/O Streams
    Replies: 8
    Last Post: November 24th, 2009, 07:36 AM
  5. printing output to console & to a text file at the same time...
    By prasanna in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: August 26th, 2009, 03:43 AM