Results 1 to 2 of 2
  1. #1
    blkshp1990 is offline Member
    Join Date
    Nov 2009
    Posts
    3
    Rep Power
    0

    Default Problem loading in a .txt file

    Could someone please tell me why this code doesn't load in the .txt file. I know that I have the .txt file in the same folder as the code.

    import java.io.*;

    public class Grid implements GridInterface {

    public void load(String sourceName) {

    try {
    BufferedReader br = new BufferedReader(new FileReader(sourceName));
    } catch (FileNotFoundException e) {
    System.out.println("File not found");
    }

    }

    MAIN PROGRAM

    public class GroupCheck {

    public static Grid grid = new Grid();
    public static void main(String[] args) {
    String sourceName = "grid1.txt";
    grid.load(sourceName);

    }

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Few things,

    1. In each class I can see that the close bracket is missing.
    2. Did you implement the interface, GridInterface?

    It's better if you can post the complete error message here.

Similar Threads

  1. loading files contained within app jar file
    By thorne_ in forum New To Java
    Replies: 3
    Last Post: 05-18-2009, 02:26 PM
  2. loading .properties file dynamically
    By nanaji in forum Advanced Java
    Replies: 3
    Last Post: 03-17-2009, 03:40 AM
  3. loading a text file
    By nick2price in forum New To Java
    Replies: 2
    Last Post: 12-24-2008, 12:46 AM
  4. Loading of JSP file failed
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-06-2007, 01:15 AM

Posting Permissions

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