title: Java: Accessing a File from an FTP Server
body: <p>So I have this FTP server with a bunch of folders and files inside.</p>
  
  <p>My program needs to access this server, read all of the files, and display their data.</p>
  
  <p>For development purposes I've been working with the files on my hard drive, right in the "src" folder.</p>
  
  <p>But now that the server is up and running, I need to connect the software to it.</p>
  
  <p>Basically what I want to do is get a list of the Files in a particular folder on the server.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>URL url = null;
  File folder = null;
  try {
      url = new URL ("ftp://username:password@www.superland.example/server");
      folder = new File (url.toURI());
  } catch (Exception e) {
      e.printStackTrace();
  }
  data = Arrays.asList(folder.listFiles(new FileFilter () {
      public boolean accept(File file) {
          return file.isDirectory();
      }
  }));
  </code></pre>
  
  <p>But I get the error "URI scheme is not 'file'."</p>
  
  <p>I understand this is because my URL starts with "ftp://" and not "file:"</p>
  
  <p>However I can't seem to figure out what I'm supposed to do about it!</p>
  
  <p>Maybe there's a better way to go about this?</p>