hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ChingShen <chingshenc...@gmail.com>
Subject Re: how to use FileSystem Object API
Date Thu, 12 Feb 2009 12:19:08 GMT
you have to specify a hadoop-xxx-core.jar file.

for example:
javac -cp hadoop-xxx-core.jar localtohdfs.java


On Thu, Feb 12, 2009 at 7:58 PM, Ved Prakash <meramailinglist@gmail.com>wrote:

> I m trying to run following code
>
> public class localtohdfs {
> public static void main()
> {
>          Configuration config = new Configuration();
>          FileSystem hdfs = FileSystem.get(config);
>          Path srcPath = new Path("/root/testfile");
>          Path dstPath = new Path("testfile_hadoop");
>          hdfs.copyFromLocalFile(srcPath, dstPath);
> }
> }
>
> when I do javac i see
> [root@nlb-2 hadoop-0.17.2.1]# javac localtohdfs.java
> localtohdfs.java:3: package org.apache.hadoop does not exist
> import org.apache.hadoop.*;
> ^
> localtohdfs.java:7: cannot find symbol
> symbol  : class Configuration
> location: class localtohdfs
>          Configuration config = new Configuration();
>          ^
> localtohdfs.java:7: cannot find symbol
> symbol  : class Configuration
> location: class localtohdfs
>          Configuration config = new Configuration();
>                                     ^
> localtohdfs.java:8: cannot find symbol
> symbol  : class FileSystem
> location: class localtohdfs
>          FileSystem hdfs = FileSystem.get(config);
>          ^
> localtohdfs.java:8: cannot find symbol
> symbol  : variable FileSystem
> location: class localtohdfs
>          FileSystem hdfs = FileSystem.get(config);
>                            ^
> localtohdfs.java:9: cannot find symbol
> symbol  : class Path
> location: class localtohdfs
>          Path srcPath = new Path("/root/testfile");
>          ^
> localtohdfs.java:9: cannot find symbol
> symbol  : class Path
> location: class localtohdfs
>          Path srcPath = new Path("/root/testfile");
>                             ^
> localtohdfs.java:10: cannot find symbol
> symbol  : class Path
> location: class localtohdfs
>          Path dstPath = new Path("testfile_hadoop");
>          ^
> localtohdfs.java:10: cannot find symbol
> symbol  : class Path
> location: class localtohdfs
>          Path dstPath = new Path("testfile_hadoop");
>                             ^
> 9 errors
>
>
> CLASS_PATH="/root/newhadoop/hadoop-0.17.2.1/src/java:/root/newhadoop/hadoop-0.17.2.1/conf:/usr/java/jdk1.6.0/lib"
>
> PATH="/usr/java/jdk1.6.0/bin:/usr/local/apache-ant-1.7.1/bin:/root/newhadoop/hadoop-0.17.2.1/bin:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
> HADOOP_HOME="/root/newhadoop/hadoop-0.17.2.1"
> JAVA_HOME="/usr/java/jdk1.6.0/"
>
> Where is the problem?
>
> thanks and regards!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message