This is my method here:
private void trackPrinter(){
File file = new File("track.txt");
String absolutePath = file.getAbsolutePath();
String filePath = absolutePath;
try {
FileReader readerT = new FileReader(filePath);
BufferedReader brT = new BufferedReader(readerT);
jTextArea2.read(brT, null);
brT.close();
jTextArea2.requestFocus();
} catch(Exception e) { JOptionPane.showMessageDialog(null, e);
}
}
I've tried many different ways to pass the file in but each time it throws a NullPointerException. if i use jfilechooser the method works fine, except i want the file to open and read on start up.