title: Java.io.File.length() returns 0
body: <p>I'm doing a applet for ftp file transfers and I need to know the size of a local file (for download resumes). The problem is the File.length() returns 0.</p>
  
  <p>The file exists (checked with File.exists()), and has more than 0 bytes (in Windows at least).</p>
  
  <p>I don't know where more to look to find out why length() is returning 0.</p>
  
  <p>Here is part of the code and the result.</p>
  
  <pre><code>long fileOffset = 0;
  
  if(localfile.exists()){
      fileOffset = localfile.length();
      System.out.println("The file " + localfile.getAbsolutePath() + " has " + localfile.length() +" in size");
      System.out.println("Resume at: " + fileOffset);
      outputStream.skip(fileOffset);
      ftp.setRestartOffset(fileOffset);
      count = fileOffset;
  }
  </code></pre>
  
  <p>And the result in the console is:</p>
  
  <pre><code>The file D:\test\About Downloads.pdf has 0 in size
  Resume at: 0
  </code></pre>
  
  <p>Thanks</p>