Here is your problem:
String filename = chooser.getSelectedFile().getName();
try
{
FileReader reader = new FileReader(filename);
You need to specify a path. You are getting the filename of the selected file, but disregarding the path. In this case, FileReader
will use the current working directory of your process as the file path.
Try this...
File selectedFile = chooser.getSelectedFile();
... then you can ...
FileReader reader = new FileReader(selectedFile);