How do I run this simple Java program to read bytes from a text file stored in directory/words in HDFS? Do I need to create a jar file for the purpose?
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.hadoop.*;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class filesystemhdfs
{
public static void main(String args[]) throws MalformedURLException, IOException
{
byte[] b=null;
InputStream in=null;
in=new URL("hdfs://localhost/words/file").openStream();
in.read(b);
System.out.println(""+b);
for(int i=0;i<b.length;i++)
{
System.out.println("b[i]=%d"+b[i]);
System.out.println(""+(char)b[i]);
}
}
}