Three days i was trying to figure out how to read file using relative file path. In eclipse this compiles and works great, but when i export app. It says that it can't find the file. here is the screenshot and code i work on.
This code works, but only in eclipse, it compiles and does job perfectly. But when i export it as as runnable jar file i get an error, that it cannot locate licenca.txt
BufferedReader in = new BufferedReader(new FileReader(new File("licenca.txt").getPath()));
String str;
while ((str = in.readLine()) != null) {
taLicenca.append(str + "\n");
}
here is the screenshot of my project files
i have tried use of scanner function, still the same result, it works in eclipse, but doesn't work on export. Here is the error message: