hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shimi K" <shimi....@gmail.com>
Subject Re: Reading Configuration File
Date Wed, 16 Apr 2008 04:30:05 GMT
Just put it in the classpath

On Tue, Apr 15, 2008 at 11:50 PM, Natarajan, Senthil <senthil@pitt.edu>
wrote:

> Hi,
> How to read configuration file in Hadoop.
> I tried by copying the file in HDFS and also placing within the jar file.
>
> I tried like this in Map constructor
> Configuration conf = new Configuration();
>          FileSystem fs = FileSystem.get(conf);
>          Path inFile = new Path("/file/path/configfile.txt");
>          FSDataInputStream in = fs.open(inFile);
>          properties.load(in);
>          in.close();
>
> And also like this
> //URL url = UserPattern2.class.getResource(commFile);
>          URL url = new URL("/file/path/configfile.txt");
>          if( url != null ) {
>             InputStream in = url.openStream();
>             properties.load(in);
>             in.close();
>          }
>
> Looks like it is not finding the file seems, I am getting
> NullPointerException.
> Here I am opening file and loading into Java Properties object.
>
> Please let me know what might be the problem.
>
> Thanks,
> Senthil
>

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