title: Java & symbolic links in windows
body: <p>I've been playing with <code>java.nio.file.Files</code> and stumbled upon a strange issue. I have a symbolic link, but <code>Files.isSymbolicLink()</code> and symbolic link attribute of  <code>Files.readAttributes()</code> show different results.</p>
  
  <p>Here's how I create the link:</p>
  
  <pre><code>D:\DEV\test&gt;mklink /D link1 components
  symbolic link created for link1 &lt;&lt;===&gt;&gt; components
  </code></pre>
  
  <p>Relevant java code:</p>
  
  <pre><code>Path symLinkDirectory = Paths.get("D:\\DEV\\test\\link1");
  DosFileAttributes dosFileAttributes = Files.readAttributes(symLinkDirectory, DosFileAttributes.class);
  
  System.out.println(String.format(
          "Files.isSymbolicLink(): %b, dosFileAttributes.isSymbolicLink(): %b", 
          Files.isSymbolicLink(symLinkDirectory), dosFileAttributes.isSymbolicLink()));
  </code></pre>
  
  <p>Gives me this output:</p>
  
  <blockquote>
    <p>Files.isSymbolicLink(): true, dosFileAttributes.isSymbolicLink(): false</p>
  </blockquote>
  
  <p>Could anyone tell me why attributes report that the file is not a symbolic link? Am I missing something? Is this happening on unix too?</p>