How can I read a file from a relative path?
I´ve tried this, but without success:
package es;
import java.io.File;
import java.io.FileInputStream;
public class Principal {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
File file = new File("/prueba/src/es/myFile.txt");
FileInputStream fis = new FileInputStream(file);
}
}
And my project is as simple as:

The error I obtained is:
Exception in thread "main" java.io.FileNotFoundException: \prueba\src\es\myFile.txt (El sistema no puede encontrar la ruta especificada)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at es.Principal.main(Principal.java:13)
Thanks.
I found the problem:
The relative path should be: