Invalid system path issue

Im creating a file with below code:

 public static String getApplicationDirectory() {
    NSArray urls = NSFileManager.defaultManager().URLsForDirectoryInDomains(NSSearchPathDirectory.ApplicationDirectory, NSSearchPathDomainMask.UserDomainMask);
    System.out.println("#B check here:  "+ urls.size() + " URL: "+urls.get(0));
    NSURL url = (NSURL) urls.lastObject();
    String path = url.fileSystemRepresentation();
    return path;
}

when i run the application on Emulator it works perfectly fine, but when i run it on the physical device(A1428, 10.3.3) i get java.lang.Exception as shown below. Any idea why this is the case.

#B check here:  1 URL: file:///var/mobile/Containers/Data/Application/13A850AE-8DC0-4F21-A6EF-29531EE75444/Applications/
#B check here:  1 URL: file:///var/mobile/Containers/Data/Application/13A850AE-8DC0-4F21-A6EF-29531EE75444/Applications/
#B check here:  1 URL: file:///var/mobile/Containers/Data/Application/13A850AE-8DC0-4F21-A6EF-29531EE75444/Applications/
#B check here:  1 URL: file:///var/mobile/Containers/Data/Application/13A850AE-8DC0-4F21-A6EF-29531EE75444/Applications/
#B.loading properties from file:/var/mobile/Containers/Data/Application/13A850AE-8DC0-4F21-A6EF-29531EE75444/Applications/myFile.properties
java.lang.Exception: Invalid system path:/var/mobile/Containers/Data/Application/13A850AE-8DC0-4F21-A6EF-29531EE75444/Applications, read:false, write:false

resolved it by using below code which can be found in MOE bechmark sample application

public static String getApplicationDirectory() {
        return ((NSURL) NSFileManager.defaultManager().URLsForDirectoryInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask).firstObject()).fileSystemRepresentation();
    }