DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2006
    Posts
    16

    (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();
    }
    }

  2. #2
    Join Date
    Dec 2006
    Location
    Kerala,India
    Posts
    51
    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 .

  3. #3
    Join Date
    Dec 2006
    Posts
    16
    I have access to "C:\temp\Installation" and also read and write permission. I think there is some problem with my code

  4. #4
    Join Date
    Jul 2005
    Location
    the Netherlands
    Posts
    128

  5. #5
    Join Date
    Dec 2006
    Posts
    16
    Thanks my problem is solved

Similar Threads

  1. Replies: 4
    Last Post: 09-23-2005, 11:37 AM
  2. Sql server Access denied ERROR
    By persian_celina in forum Database
    Replies: 3
    Last Post: 06-14-2005, 06:05 AM
  3. Access denied to 'D:\wwwroot\web'
    By .need help in forum ASP.NET
    Replies: 2
    Last Post: 03-10-2003, 05:04 PM
  4. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 03:53 AM
  5. Access denied error HELP!!!
    By Ryan in forum VB Classic
    Replies: 5
    Last Post: 04-25-2000, 03:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links