I want to read models.txt in WebContent/resources/db/ from IndexBean.java in src/DataTable/. How shall I set the filePath in
sc = new Scanner(new File(filePath));
I know I can achieve this by absolute path, but want to know how to do it in relative path.

And another interesting thing is: In IndexBean.java which is a Java Bean, if I run the following code, I will get the path of eclipse.exe. While if I run the same code in testFileRead.java in the same package which is not a Java Bean, I will get the path of the workspace of the application. Could someone explain this? Thanks!
File dir1 = new File("..");
try {
System.out.println("Current dir : " + dir1.getCanonicalPath());
} catch (IOException e1) {
e1.printStackTrace();
}