I found the solution. Please let me know if you have a better idea. I added the following addResource lines.
Configuration conf = new Configuration(); conf.addResource(new Path("location_of_hadoop-default.xml")); conf.addResource(new Path("location_of_hadoop-site.xml")); FileSystem fs = FileSystem.get(conf); (Would be good to update the wiki page). - CEG On Wed, Mar 12, 2008 at 5:04 PM, Cagdas Gerede <[EMAIL PROTECTED]> wrote: > I see the following paragraphs in the wiki ( > http://wiki.apache.org/hadoop/HadoopDfsReadWriteExample)<http://wiki.apache.org/hadoop/HadoopDfsReadWriteExample> > > >Create a [image: [WWW]] > >FileSystem<http://hadoop.apache.org/core/api/org/apache/hadoop/fs/FileSystem.html>instance > > by passing a new Configuration object. Please note that the > following example code assumes that the >Configuration object will > automatically load the *hadoop-default.xml* and > *hadoop-site.xml*configuration files. You may need to explicitly add these > resource paths if > you are not running inside of the Hadoop runtime environment. > > and > > > Configuration conf = new Configuration(); > > FileSystem fs = FileSystem.get(conf); > > When I do > > Path[] apples = fs.globPaths(new Path("*")); > for(Path apple : apples) { > System.out.println(apple); > } > > > It prints out all the local file names. > > How do I point my application to running HDFS instance? > What does "explicitly add these resource paths if you are not running > inside of the Hadoop runtime environment." mean? > > Thanks, > > - CEG > > > > -- ------------ Best Regards, Cagdas Evren Gerede Home Page: http://www.cs.ucsb.edu/~gerede Pronunciation: http://www.cs.ucsb.edu/~gerede/cagdas.html