You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@hadoop.apache.org by web service <wb...@gmail.com> on 2010/11/14 03:54:02 UTC

Accessing hdfs from a program not run with bin/hadoop

I am running a program with the following code.

[code]
............
            conf.addResource(new
Path("file:///home/mac/software/hadoop/hadoop-0.20.2/conf/core-site.xml"));
            fs = FileSystem.get(conf);
            fs.delete(new
Path("hdfs://localhost:9000/user/mac/output/output-1"), true);
............
[/code]

but I get the following exception, not sure what else configuration I would
want to add.


[code]
Exception --
.......
Wrong FS: hdfs://localhost:9000/user/mac/output/output-1, expected: file:///
.......

[/code]

Re: Accessing hdfs from a program not run with bin/hadoop

Posted by web service <wb...@gmail.com>.
Ok, I need to access file system appropriately.
This works.

hdfs = FileSystem.get(new URI(HDFS_PATH),conf);



On Sat, Nov 13, 2010 at 7:54 PM, web service <wb...@gmail.com> wrote:

> I am running a program with the following code.
>
> [code]
> ............
>             conf.addResource(new
> Path("file:///home/mac/software/hadoop/hadoop-0.20.2/conf/core-site.xml"));
>             fs = FileSystem.get(conf);
>             fs.delete(new
> Path("hdfs://localhost:9000/user/mac/output/output-1"), true);
> ............
> [/code]
>
> but I get the following exception, not sure what else configuration I would
> want to add.
>
>
> [code]
> Exception --
> .......
> Wrong FS: hdfs://localhost:9000/user/mac/output/output-1, expected:
> file:///
> .......
>
> [/code]
>