Showing posts with label java local file to hdfs copy. Show all posts
Showing posts with label java local file to hdfs copy. Show all posts

Thursday, March 1, 2012

Copy file from local disk to hdfs using java

 
Local File ====== File Copy =======> hdfs file systemHadoop
 
 
Create a project in eclipse or netbeans or any editor you like and add hadoop-core.jar and create a class named PutToHdfs and put this code
 
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DistributedFileSystem;

/**
*
*
* @author shashwat
*/
public class PutToHdfs {


Featured Posts

Run Commands for Windows

  🖥️ CPL Files (Control Panel Applets) Run via Win + R → filename.cpl Command Opens appwiz.cpl P...