URL url=new URL("ftp://aaa:[email protected]/filename.txt ");
URLConenction conn=url.getConnection();
conn.getInputStream();没装jdk 只是表明大概意思
 使用url得到连接开流的方式读取

解决方案 »

  1.   

    楼上说的不对。如果是http连接就可以打开。
            String address = "http://82.0.98.10:8080/axis/abc.txt";
            URL url = new URL(address);
            HttpURLConnection conn=(HttpURLConnection)url.openConnection();
            conn.connect();
    但是ftp是另外一个协议。java.net包里面没有 FtpURLConnection 这个类!!
    虽然两者都可以用ie浏览器打开。但ie是按照不同协议处理的。
    如果要读取ftp文件,只有用sun.net.FtpClient这个类。
      

  2.   

    URL类是对于HTTP下载的,如果你要FTP下载去http://jakarta.apache.org/site/binindex.cgi下个NET的BIRNAY包其中对于FTP的客户端已封装好.