title: intelliJ cannot find a specific method
body: <p>I am getting a compile error in the following code that I do not know how to fix.</p>
  
  <pre><code> public class Test throws IOException{
        public static void main(String[] args) {
             String path = "document.txt";
             File file = new File(path);
             Files.readString(file.toPath()); //cannot find symbol method readString(java.nio.file.Path)
        }
   }
  </code></pre>
  
  <p>but I get </p>
  
  <blockquote>
    <p>Error:(8, 14) java: cannot find symbol<br/>
    symbol:   method readString(java.nio.file.Path)<br/>
     location: class java.nio.file.Files</p>
  </blockquote>
  
  <p>There are a number of things to note.</p>
  
  <ul>
  <li>This only happens for <code>readString(Path)</code> in <code>java.nio.file.Files</code>. If I were to try <code>size(Path)</code> (another method in <code>java.nio.file.Files</code>), it works</li>
  <li><p>This code does not work in intelliJ but it works in eclipse</p></li>
  <li><p>This code works if I create a new project in intelliJ but not in my current Maven project that I cloned from github</p></li>
  </ul>
  
  <p>I have tried all suggestions <a href="https://stackoverflow.com/questions/12132003/getting-cannot-find-symbol-in-java-project-in-intellij">here</a> including:</p>
  
  <ul>
  <li>Build > Rebuild Project</li>
  <li>Recompiling just <code>Test.java</code></li>
  <li>File > Invalidate Caches</li>
  <li>Checked the /src folder is marked as source folder</li>
  <li>Reimporting Maven dependencies</li>
  </ul>