I keep getting a java.lang.NullPointerException when trying to open a txt file in eclipse. Basically, this is a main menu, and when you click the "Rules" button, the rules text file should open. Currently, the txt file is located in a package called "Resources" (which is where all of the other img files I've used in making the game are). Here's the code:
private List<String> readFile(String filename)
{
  List<String> records = new ArrayList<String>();
  try
  {
    BufferedReader buff = new BufferedReader(new InputStreamReader(
            Configuration.class.getResourceAsStream(filename)));
    String line;
    while ((line = buff.readLine()) != null)
    {
      records.add(line);
    }
    buff.close();
    return records;
  }
  catch (Exception e)
  {
    System.err.format("Exception occurred trying to read '%s'.", filename);
    e.printStackTrace();
    return null;
  }
}
//action performed
public void actionPerformed(ActionEvent ae) {
    JButton b = (JButton)ae.getSource();
    if( b.equals(newGameButton) )
        {
        flag = true;
        controller.startGame();
        buttonPressed = "newGameBtn";
        }
    if(b.equals(quitButton))
    {
        System.exit(0);
    }
    if(b.equals(ruleButton)){
        readFile("../resource/riskRules.txt");
    }
}
Appreciate the help!
 
     
    