Hi,

Some of your imports are incorrect. Both FileSystem and Path classes are
present in o.a.h.fs

Thanks
Sudhan S

On Thu, Sep 1, 2011 at 8:22 PM, Arko Provo Mukherjee <
arkoprovomukher...@gmail.com> wrote:

> Hi,
>
> My code looks like this:
>
> *import java.util.*;*
>
> *import java.lang.*;*
>
> *import java.io.*;*
>
> *import org.apache.hadoop.*;*
>
> *
> *
>
> *class MapReduce  {*
>
> *    *
>
> *public static void main(String[] args) throws Exception  {*
>
> **
>
> *        try  {*
>
> *                Path pt=new Path(
> "hdfs://localhost:54310//Users/arko/Documents/Research/HDFS/abc");*
>
> *                FileSystem fs = FileSystem.get(new Configuration());*
>
> *                BufferedWriter br=new BufferedWriter(new
>  OutputStreamWriter(fs.create(pt,true)));*
>
> *                String line;*
>
> *                line="Testing";*
>
> *                System.out.println(line);*
>
> *                br.write(line);*
>
> *                br.close();*
>
> *        }catch(Exception e){*
>
> *                System.out.println("File not found");*
>
> *        }*
>
> *    }*
>
> *}*
>
> When I compile the code, I get the following erros:
> *$javac -classpath
> /Users/arko/Documents/hadoop-0.21.0/hadoop-common-0.21.0.jar -d class/
> FileSystemCat.java clear*
>
> FileTest.java:16: cannot find symbol
> symbol  : class Path
> location: class FileTest
>                 Path pt=new
> Path("hdfs://localhost:54310//Users/arko/Documents/Research/HDFS/abc");
>                 ^
> FileTest.java:16: cannot find symbol
> symbol  : class Path
> location: class FileTest
>                 Path pt=new
> Path("hdfs://localhost:54310//Users/arko/Documents/Research/HDFS/abc");
>                             ^
> FileTest.java:17: java.io.FileSystem is not public in java.io; cannot be
> accessed from outside package
>                 FileSystem fs = FileSystem.get(new Configuration());
>                 ^
> FileTest.java:17: cannot find symbol
> symbol  : class Configuration
> location: class FileTest
>                 FileSystem fs = FileSystem.get(new Configuration());
>                                                    ^
> FileTest.java:17: java.io.FileSystem is not public in java.io; cannot be
> accessed from outside package
>                 FileSystem fs = FileSystem.get(new Configuration());
>                                 ^
> 5 errors
>
>
> Also I would like to learn the FileContext API as I want to use 0.21 for
> making appends to my file in each MR round.
> Would be great if you have a place where I can have a look at some code
> snippets that have demonstrated the use of FileContext for easy learning.
>
> Many thanks in advance!
> Warm regards
> Arko
>
> On Thu, Sep 1, 2011 at 2:24 AM, Arun C Murthy <a...@hortonworks.com> wrote:
>
>> What kind of example code are you looking for? It will help if you
>> describe your use case...
>>
>> On Aug 31, 2011, at 1:13 AM, Arko Provo Mukherjee wrote:
>>
>> > Hi,
>> >
>> > I am using HDFS on 0.20.203 for my project.
>> >
>> > I can see the API has evolved much over the different versions.
>> >
>> > Can you please guide me to some link where I can find some example code
>> for any version >= 0.20.203 so that I can quick start the process.
>> >
>> > Thanks much in advance!
>> >
>> > Warm regards
>> > Arko
>>
>>
>

Reply via email to