There is no guide on how to compile Hadoop code in the Hadoop: The Definitive Guide book. I am not using any Java IDE for this. Do I need to install any Java IDE? I made JAR file of the code and tried running it with Hadoop command but it is not working on Ubuntu. The book says to install and compile the examples using instructions on the book's website, but I cannot find it on O'Reilly's website.
If someone can show me how to compile simple code like this, that would be a great help to me.
import org.apache.hadoop.fs;
import java.io.IOException;
import java.net.URL;
import org.apache.hadoop.io.IOUtils;
public class URLCat{
static{
URL.setURLStreamHandlerFactory(new FSUrlStreamHandlerFactory());
}
public static void main(String[] args) throws Exception{
InputStream in =null;
try{
in=new URL(args[0]).openStream();
IOUtils.copyBytes(in,System.out,4096,false);
}finally{
IOUtils.closeStream(in);
}
}
}