I placed a text file myapp.txt in the folder ~/workspace/PayrollApp/src/org/username/payrollapp
. However, it was not opening in the Java program.
To make it work correctly, I had to do use the following path in the Java program when opening the file:
src/org/username/payrollapp/pay.txt
Code as follows:
try {
FileReader fr = new FileReader("src/org/username/payrollapp/pay.txt");
BufferedReader br = new BufferedReader(fr);
String line = null;
while ((line = br.readLine()) != null) {
String[] result = line.split(":");
result[1] = result[1].replaceAll("~~", "nn");
helpText.append(result[0] + ": " + result[1] + "n");
}
helpDialog.pack();
helpDialog.setVisible(true);
} catch (IOException ex) {
ex.printStackTrace();
}