I have read sources here & there, but did not get the following code working. Basically, I wish to read a text file, named 'Administrator' from the folder 'src'. I will need a relative path, since this project may be transferred to another person. Please be patient with me.
public void staffExists () throws IOException
{
//http://stackoverflow.com/questions/2788080/reading-a-text-file-in-java
BufferedReader reader = new BufferedReader(new FileReader(getClass().getResourceAsStream ("/DBTextFiles/Administrator.txt")));
try
{
String line = null;
while ((line = reader.readLine()) != null)
{
if (!(line.startsWith("*")))
{
System.out.println(line);
}
}
}
catch (IOException ex)
{
ex.printStackTrace();
}
finally
{
reader.close();
}
}