title: Java java.io.filenotfoundexception for file path with cyrillic characters
body: <p>I have a file whose name contains characters not only from the plain ASCII character set, but also from a non-ASCII character set. In my case it contains Cyrillic characters.</p>
  
  <p>Here's a snippet of my code:</p>
  
  <pre><code>String fileName = "/Users/dnelepov/Downloads/тест изображение.png";
  File sendFile = new File(fileName);
  if (sendFile.exists()) {
      // Some code
  }
  </code></pre>
  
  <p>The code in <code>sendFile.exists</code> <code>if</code> block is not being executed.</p>
  
  <p>Why isn't the file recognized?</p>
  
  <p><strong>My system configuration</strong>
  <strong>locale</strong></p>
  
  <pre><code>LANG="ru_RU.UTF-8"
  LC_COLLATE="ru_RU.UTF-8"
  LC_CTYPE="ru_RU.UTF-8"
  LC_MESSAGES="ru_RU.UTF-8"
  LC_MONETARY="ru_RU.UTF-8"
  LC_NUMERIC="ru_RU.UTF-8"
  LC_TIME="ru_RU.UTF-8"
  LC_ALL="ru_RU.UTF-8"
  </code></pre>
  
  <p><strong>uname -a</strong></p>
  
  <pre><code>Darwin Dmitrys-MacBook-Pro.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
  </code></pre>
  
  <p><strong>java -version</strong></p>
  
  <pre><code>java version "1.7.0_21"
  Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
  Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found that this error is on JDK from Oracle.</p>
  
  <p>I created project on Eclipse, and file was found. I checked project properties and found Mac OS 6 JDK.</p>
  
  <p>Then I change it to JDK 7 and file was not Found again.</p>
  
  <p>My problem is that I need to use JDK 7 with JavaFX. Not Mac OS version. So my problem still exists.</p>
  
  <p><strong>I've made a video to show this error</strong> <a href="http://www.youtube.com/watch?v=JZwN7hlgaw0&amp;feature=youtu.be" rel="nofollow noreferrer">Video with error</a></p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Thanks to eumust for answer, this code works:</p>
  
  <pre><code>Path path = Paths.get("/Users/dnelepov/Downloads/test/");
      Files.walkFileTree(path, new SimpleFileVisitor&lt;Path&gt;() {
          @Override
          public FileVisitResult visitFile(Path oneF, BasicFileAttributes attrs) throws IOException {
              System.out.println("FILE:" + oneF);
              if (Files.exists(oneF)) {
                  System.out.println("EXISTS:" + oneF);
              }
              return FileVisitResult.CONTINUE;
          }
      });
  </code></pre>
  
  <p><a href="https://stackoverflow.com/a/17481204/849961">https://stackoverflow.com/a/17481204/849961</a></p>