I get this error when trying to open a file:
java.io.FileNotFoundException: D:\Portable%20Programs\Android%20Development\workspace3\XXX-desktop\bin\World_X.fr (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.util.Scanner.<init>(Unknown Source)
The file exists in the directory, but I still get this error. However, when I copy the same file in the Project src folder of the Eclipse workspace, this exception is not returned (although this method also creates the World_X.fr file in the bin folder).
What I'm actually trying to do is get the absolute location of the .jar file through this:
fileLocation = new String(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath());
And then I add "World_X.fr" to the fileLocation line, but this does not work. Please help me in this regard.
Rafay source
share