java the system can not find the file specified
<p>I used Java to copy file but it appeared a exception (the system can not find the file specified).</p>

<p>The codes are </p>

<pre><code>public static void copyFile(String sourceFile, String destFile){
    try {       
        InputStream in = new FileInputStream(sourceFile);
        OutputStream os = new FileOutputStream(destFile);
        byte[] buffer = new byte[1024];
        int count;
        while ((count = in.read(buffer)) &gt; 0) {
            os.write(buffer, 0, count);
        }
        in.close();
        os.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
</code></pre>

<p>The test codes</p>

<pre><code>public static void main(String[] args) {
    String name = getFileName("D:/z/temp.txt");
    String target = "D:/tem.txt";
    copyFile(name, target);
}
</code></pre>

<p>the exception is <code>java.io.FileNotFoundException: temp.txt(the system can not find the file specified)</code></p>

<ol>
<li>The file 'temp.txt' is existence.</li>
<li>The path is right no problem.</li>
</ol>

<p>I guess that is the problem of Permissions. who can come up with the answer thanks!</p>
