Source.fromFile not working for HDFS file path
<p>i am trying to read file contents from my hdfs for that i am using <strong>Source.fromFile()</strong>. It is working fine when my file is in local system but throwing error when i am trying to read file from HDFS.</p>

<pre><code>object CheckFile{
    def main(args:Array[String]) {
        for (line &lt;- Source.fromFile("/user/cloudera/xxxx/File").getLines()) {
            println(line)
        }
    }
}
</code></pre>

<p>Error:</p>

<pre><code>java.io.FileNotFoundException: hdfs:/quickstart.cloudera:8080/user/cloudera/xxxx/File (No such file or directory)
</code></pre>

<p>i searched but i am not able to find any solutions to this.</p>

<p>Please help</p>