?????????hello???????Hadoop ????? ??????
????[root@hadoop local]# touch hello
????[root@hadoop local]# vi hello
????[root@hadoop local]# hadoop fs -put hello /
????????

 

package hadoop.jack.javacallhadoop;
import java.io.InputStream;
import java.net.URL;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.io.IOUtils;
public class App1 {
public static String HDFS_PATH="hdfs://hadoop:9000/hello";
/**
* @param args
*/
public static void main(String[] args) throws Exception{
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
final URL url =new URL(HDFS_PATH);
InputStream in = url.openStream();
IOUtils.copyBytes(in?? System.out?? new Configuration());
}
}