-
(Access is denied) error
Could anyone please tell me why am I getting the error "C:\temp\Installation (Access is denied)".
I am trying to copy selected few files from source to destination.
public class filesMove
{
public filesMove()
{
}
void copyDirectory(File source, File destination) throws IOException
{
System.out.println("source: "+source);
//output: source: D:\fonts\xyz.PFB
//output: source: D:\fonts\xyz.PFM
System.out.println("destination:"+destination);
//output: destination: C:\temp\Installation
copyFile(source, destination);
}
private void copyFile(File src, File dst) throws IOException
{
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}
in.close();
out.close();
}
}
-
if you running on Unix box, check the permission. you should have write permission for the directory C:\temp\Installation and read permission for the files you are copying..(make sure that java is running with the same user)
in Windows i don't know how to resolve .
-
I have access to "C:\temp\Installation" and also read and write permission. I think there is some problem with my code
-
-
Thanks my problem is solved
Similar Threads
-
By kalamelka in forum Database
Replies: 4
Last Post: 09-23-2005, 11:37 AM
-
By persian_celina in forum Database
Replies: 3
Last Post: 06-14-2005, 06:05 AM
-
By .need help in forum ASP.NET
Replies: 2
Last Post: 03-10-2003, 05:04 PM
-
By Martin in forum VB Classic
Replies: 22
Last Post: 12-03-2001, 03:53 AM
-
By Ryan in forum VB Classic
Replies: 5
Last Post: 04-25-2000, 03:11 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks