You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by Bill Yu <yu...@gmail.com> on 2009/09/09 06:54:23 UTC

How to define the path of HDFS?

Hi everyone,

     when I run the following code:

     ObjectInputStream in = new ObjectInputStream(new
FileInputStream("hdfs://localhost:9000/myDir/trajectory/test.obj"));

     it throws an error that the directory is not exist, how can I define
the its path ?
     Any suggestion is appreciate !

Thanks,
Austin

Re: How to define the path of HDFS?

Posted by Steve Loughran <st...@apache.org>.
Bill Yu wrote:
> Hi everyone,
> 
>      when I run the following code:
> 
>      ObjectInputStream in = new ObjectInputStream(new
> FileInputStream("hdfs://localhost:9000/myDir/trajectory/test.obj"));
> 
>      it throws an error that the directory is not exist, how can I define
> the its path ?
>      Any suggestion is appreciate !
> 

1. This is not a dev question, please use the -user lists
2. Java.io classes aren't the way to open HDFS files

Re: How to define the path of HDFS?

Posted by Boris Shkolnik <bo...@yahoo-inc.com>.
You should use FileSystem methods to do it..
E.g. 
FSDataInputStream  open(Path f)


On 9/8/09 9:54 PM, "Bill Yu" <yu...@gmail.com> wrote:

> Hi everyone,
> 
>      when I run the following code:
> 
>      ObjectInputStream in = new ObjectInputStream(new
> FileInputStream("hdfs://localhost:9000/myDir/trajectory/test.obj"));
> 
>      it throws an error that the directory is not exist, how can I define
> the its path ?
>      Any suggestion is appreciate !
> 
> Thanks,
> Austin