hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajey Shah <ajey.s...@gmail.com>
Subject How do I copy files from my linux file system to HDFS using a java prog?
Date Wed, 30 Apr 2008 22:00:57 GMT

Hello all,

I need to copy files from my linux file system to HDFS in a java program and
not manually. This is the piece of code that I have.

try {

			FileSystem hdfs = FileSystem.get(new Configuration());
			
			LocalFileSystem ls = null;
			
			ls = hdfs.getLocal(hdfs.getConf());
			
			hdfs.copyFromLocalFile(false, new Path(fileName), new Path(outputFile));

		} catch (Exception e) {
			e.printStackTrace();
		}

The problem is that it searches for the input path on the HDFS and not my
linux file system.

Can someone point out where I may be wrong. I feel it's some configuration
issue but have not been able to figure it out. 

Thanks.
-- 
View this message in context: http://www.nabble.com/How-do-I-copy-files-from-my-linux-file-system-to-HDFS-using-a-java-prog--tp16992491p16992491.html
Sent from the Hadoop core-user mailing list archive at Nabble.com.


Mime
View raw message