Results 1 to 2 of 2
  1. #1
    yap_1991 is offline Member
    Join Date
    Apr 2010
    Posts
    19
    Rep Power
    0

    Default FTP by web links

    hi all,

    here are my codes, Im encountering some problems which will also be listed below can anynoe shed some light to this error that i cannot solve?

    Java Code:
    import java.io.*;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.FileOutputStream;
    
    public class ftp {
    
        public static void main(String[] args) {
        	
        	try{
        	
        URL url = new URL("ftp://ftp.wwpdb.org//pub//pdb//data//structures//all//pdb//;type=i");
        URLConnection con = url.openConnection();
    	
    	BufferedInputStream in = new BufferedInputStream(con.getInputStream());
    	FileOutputStream out = new FileOutputStream("D://project1//MP Project//FTP Downloads//");
    	
    	int i = 0;
    	byte[] bytesIn = new byte[1024];
    	
    	while ((i = in.read(bytesIn)) >= 0)
    	 {
    	out.write(bytesIn, 0, i);
    	 }
    	out.close();
    	in.close(); 
        	} catch(Exception e) 
        		{
        			e.printStackTrace();
        		}
        }   
    }
    the error im getting is this:

    java.io.FileNotFoundException: D:\project1\MP Project\FTP Downloads (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.j ava:179)
    at java.io.FileOutputStream.<init>(FileOutputStream.j ava:70)
    at ftp.main(ftp.java:15)

    Process completed.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

Similar Threads

  1. Skipping links!!!
    By jvh in forum New To Java
    Replies: 2
    Last Post: 03-04-2010, 12:11 AM
  2. browser and links
    By toker in forum New To Java
    Replies: 2
    Last Post: 02-21-2010, 01:27 AM
  3. Finding web links
    By ishdevil in forum New To Java
    Replies: 2
    Last Post: 02-11-2010, 11:42 AM
  4. links between variables
    By Keerti in forum New To Java
    Replies: 2
    Last Post: 08-12-2008, 03:07 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
  •