title: Java - URL to File
body: <p>I am trying to create a method that displays a list of files in a given directory. This works fine for normal directories (on disk) but when I enter a url my list of files is null.</p>
  
  <pre><code>    public void getListOfFiles(String folderLocation){
      File folder = new File(folderLocation);
      File[] listFiles = folder.listFiles();
  
      for(int i = 0; i &lt; 10; i++){
          System.out.println(listFiles[i]);
      }
  }
  </code></pre>
  
  <p>I think my problem is because the File 'folder' is removing one of the '/' in my folderLocation (http://...)</p>
  
  <p>I have tried using URL and URI but have had no luck! Can anyone help?</p>