Summary - this code:
File f = new File("dbFile.dat");
f.getAbsolutePath();
Returns:
/Applications/dbFile.dat
The problem is that my application's resources (3d party jars for instance) are located in "Applications/Foobar.app/...".
How to get the path to my install folder without hardcoding anything?
Details:
I'm using a 3d party library for which I need to provide a filename:
ls = new LookupService("dbFile.dat");
When distributed, this file is placed in the root of my install folder, next to the executable files - works great on Windows.
However, on Mac I get a FNF exception because the library isn't searching in the correct location:
java.io.FileNotFoundException: dbFile.dat (The system cannot find the file specified)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(Unknown Source)
...