Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    Timbaktu
    Posts
    185

    Unanswered: Reading File in Java

    I have a CSV file which has got the Servername,password and some other information. The user would supply me the Servername and the username and I need to get the password from the CSV file using the Java.

    Any Help?

  2. #2
    Join Date
    Mar 2004
    Posts
    9

    Re: Reading File in Java

    Originally posted by sqlserver2k
    I have a CSV file which has got the Servername,password and some other information. The user would supply me the Servername and the username and I need to get the password from the CSV file using the Java.

    Any Help?
    To read from file:
    ...
    String str;
    ...

    try {
    BufferedReader in = new BufferedReader(new FileReader(FILENAME));
    while ((str = in.readLine()) != null) {

    //Your code to retrieve username and servername using variable str

    }
    in.close();
    } catch (IOException e) {
    System.err.println("Error reading file:"+e.toString());
    }

  3. #3
    Join Date
    Apr 2004
    Posts
    1

    Wink Re: Reading File in Java

    If the file is adhering to CSV format, you can use the simple data file read/write library I've written:

    http://www.infomata.com/products/datafile.shtml

    It's a freeware and I've gotten good feedback on it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •