I am getting
open failed: EACCES (Permission denied)
EACCES (Permission denied)
on the line OutputStream myOutput = new FileOutputStream
OutputStream myOutput = new FileOutputStream
I am creating a folder under /data/ in my init.rc (mucking around with the aosp on Nexus 7) and had exactly this problem.
It turned out that giving the folder rw (666) permission was not sufficient and it had to be rwx (777) then it all worked!