hello i have to execute this command:
docRules = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse( new File(IeplcDeployRules.clx));
When i try to create a parser i get the following error:
java.io.FileNotFoundException: /.../IeplcDeployRules.clx (Permission denied)
if i try manually to read the file it works but i cannot write in it because following are the permission.
-rwxr-xr-x 1 ieplcop ieplcdev 3424 Aug 11 17:16 IeplcDeployRules.clx
I do not want to change the permission since the file NEED only to be read from my Java application. I suppose there shold be therefore a way to specify that the file should be opened in read only mode.
I look the possible paramenter of File() parse() and .newDocumentBuilder() but none of them let me specify that the operation is read only!!
Any idea about how to procede?
Cheers, Ste
I do not know what the
DocumentBuilder
does internally, I would have to read its source. But you can use a differentInputSource
instead of aFile
, so that you have full control. For example a FileReader.You should pass an
InputStream
to theparse
method instead of aFile
.For example: