File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Access Denied Error with RandomAccessFile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Access Denied Error with RandomAccessFile" Watch "Access Denied Error with RandomAccessFile" New topic
Author

Access Denied Error with RandomAccessFile

Kedarnath Bhagwat
Greenhorn

Joined: Oct 27, 2009
Posts: 20
I am accessing the file using RandomAccessFile .
I get following error
Exception in thread "main" java.lang.RuntimeException: The given file does not exist.
at scjd.DBFileReader.main(DBFileReader.java:213)
Caused by: java.io.FileNotFoundException: C:\db-1x3.db (Access is denied)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
at scjd.DBFileReader.main(DBFileReader.java:100)
Java Result: 1


The file exists at the location and if I only read is successful operation with parameter "r"
If I pass "rw" then I get the above error.

Can anyone help me with this error .

kmbhagwat , SCJP 6
Kedarnath Bhagwat
Greenhorn

Joined: Oct 27, 2009
Posts: 20
Oops ! I figured it out .
I put the file in C:\ drive . It was giving me only read access .
I created C:\test folder and put the db file there .
And now I don't get the error 'Access Denied' .

Isn't this weired ?
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
It must have been read only access. Once you placed in the folder the folder must not have read only access!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access Denied Error with RandomAccessFile
 
Similar Threads
NX: db-2x1?
java I/O
Problem in using TOMCAT
AccessControlException when accessing Bean in JBOSS
Database file reader