Reading files from app engine project running in eclipse

44 Views Asked by At

I am trying to read a file stored in my computer from the app engine project which I am debugging in eclipse. But I am getting security exception with the following error:

    java.security.AccessControlException: access denied    ("java.io.FilePermission" ""D:\PROJECTS\LocBiz-AppEngine\war\Key\locbiz_key.json"" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)

How do I read the file?

1

There are 1 best solutions below

0
koma On

Put the files you want to read on the classpath and use the class loader to read them in

Foo.class.getResource("myfile");

A Java App Engine application's access to the classes in the Java standard library is limited to the whitelisted classes.