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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 8 of 8

Thread: How do I read a file best?

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How do I read a file best?

    I am trying to make a program which can give me a browsing function to choose a file, I cannot figure out how this is done. I have a method that will go through each file in a zip file but I have not been able to figure out a good way to choose the file and pass it thruogh this method.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How do I read a file best?

    a good way to choose the file
    The JFileChooser class could help in doing that for disk files.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    mikeymoo (September 25th, 2014)

  4. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: How do I read a file best?

    Awesome, thanks got it to work!
    Though I get a bit worried when you put it like that.
    Will this mean I cant use this to get a file from a server or something like Git?

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How do I read a file best?

    To get files from a server you need to send some kind of request to the server. Some protocols for getting files from servers include HTTP and FTP.
    JFileChooser is for files on a local disk.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: How do I read a file best?

    OK thanks! You have been a big help

  7. #6
    Junior Member
    Join Date
    Dec 2017
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How do I read a file best?

    To use JFileChooser which jar i have to load in my Eclipse?

  8. #7
    Member
    Join Date
    Dec 2013
    Location
    Honolulu
    Posts
    83
    Thanks
    1
    Thanked 4 Times in 2 Posts

    Default Re: How do I read a file best?

    What was it you wanted to work on? Jar files. Say if I was working on a web project. I would add titles, fonts, styles, background color, and JTextArea, if there are any feedbacks from guest, as in forum.

  9. #8
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: How do I read a file best?

    Quote Originally Posted by ssbsuresh View Post
    To use JFileChooser which jar i have to load in my Eclipse?
    No special jar files have to be referenced: JFileChooser is part of the Java runtime.

    Please don't resurrect threads that were dealt with years ago just because they might mention a word like "JFileChooser" that you are interested in. It is better to start your own thread: that way you can describe precisely what your question is.

    Closing.

Similar Threads

  1. help with GUI .. read file and write file
    By kernal in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 14th, 2012, 10:38 AM
  2. Read input, read file, find match, and output... URGENT HELP!
    By MooseHead in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 3rd, 2012, 11:01 AM
  3. [SOLVED] Can I have two scanners to the same file? (I want to read through one file 2 times)
    By beginnerprogrammer in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: October 20th, 2011, 11:23 AM
  4. Java I/O File code; how to read/write file
    By ryu2le in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 18th, 2011, 05:51 PM
  5. Read a text file and parse the contents of file
    By HelloAll in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: March 3rd, 2011, 05:47 AM