Friday, 15 May 2015

File works in Java 1.5 but not in Java 7 (java.io.FileNotFoundException Permission Denied) -


I have a file I am attempting to access. When I moved it to Java 1.5, it's OK Was there. Since then, I've upgraded to Java 7 and now I'm getting a java.io.phileNotFoundException permission denied error. Java.io.FileOutputStream at java.io.FileOutputStream.open (the original method)

  java.io.FileNotFoundException: /folder/test.xml (permission denied). & Lt; Init & gt; (  

This is actually trying to write, but trying to write it on. File using XMLEncoder

  XMLEncoder encoder = New XMLEncoder (New BufferedOutputStream (New FileOutputStream (filename)); encoder.writeObject (encoder.close);    

If you are under Unix / Linux, then try the following commands because of the user.Java $ touch /folder/test.xml

If your file Sitting in other places (for example /home/AAA/folder/test.xm L), change the above path.

The idea is that your current user can write file

No comments:

Post a Comment