You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-user@hadoop.apache.org by praveenesh kumar <pr...@gmail.com> on 2015/12/16 16:18:11 UTC
Best way to pass project resources in Java MR
Hello folks
Basic Java MR question.
What is the right practice to pass any program specific files (sitting in
src/main/resources) in your project folder to your mapper.
I tried the following and it didn't work
1. Inside mapper setup() ->
ClassLoader.getClassLoader().getResource("myfile_in_jar")
ClassLoader.getSystemClassLoader().getResource("myfile_in_jar");
2. Inside Driver run() method
Re: Best way to pass project resources in Java MR
Posted by Ashwanth Kumar <as...@googlemail.com>.
Map/Reduce task JVM has your JAR in the classpath.
Did you try "MapperClass.class.getResource("/myfile_in_jar")" ?
On Wed, Dec 16, 2015 at 8:48 PM, praveenesh kumar <pr...@gmail.com>
wrote:
> Hello folks
>
> Basic Java MR question.
>
> What is the right practice to pass any program specific files (sitting in
> src/main/resources) in your project folder to your mapper.
>
> I tried the following and it didn't work
>
> 1. Inside mapper setup() ->
>
> ClassLoader.getClassLoader().getResource("myfile_in_jar")
>
> ClassLoader.getSystemClassLoader().getResource("myfile_in_jar");
>
> 2. Inside Driver run() method
>
>
>
>
>
--
Ashwanth Kumar / ashwanthkumar.in
Re: Best way to pass project resources in Java MR
Posted by Ashwanth Kumar <as...@googlemail.com>.
Map/Reduce task JVM has your JAR in the classpath.
Did you try "MapperClass.class.getResource("/myfile_in_jar")" ?
On Wed, Dec 16, 2015 at 8:48 PM, praveenesh kumar <pr...@gmail.com>
wrote:
> Hello folks
>
> Basic Java MR question.
>
> What is the right practice to pass any program specific files (sitting in
> src/main/resources) in your project folder to your mapper.
>
> I tried the following and it didn't work
>
> 1. Inside mapper setup() ->
>
> ClassLoader.getClassLoader().getResource("myfile_in_jar")
>
> ClassLoader.getSystemClassLoader().getResource("myfile_in_jar");
>
> 2. Inside Driver run() method
>
>
>
>
>
--
Ashwanth Kumar / ashwanthkumar.in
Re: Best way to pass project resources in Java MR
Posted by Ashwanth Kumar <as...@googlemail.com>.
Map/Reduce task JVM has your JAR in the classpath.
Did you try "MapperClass.class.getResource("/myfile_in_jar")" ?
On Wed, Dec 16, 2015 at 8:48 PM, praveenesh kumar <pr...@gmail.com>
wrote:
> Hello folks
>
> Basic Java MR question.
>
> What is the right practice to pass any program specific files (sitting in
> src/main/resources) in your project folder to your mapper.
>
> I tried the following and it didn't work
>
> 1. Inside mapper setup() ->
>
> ClassLoader.getClassLoader().getResource("myfile_in_jar")
>
> ClassLoader.getSystemClassLoader().getResource("myfile_in_jar");
>
> 2. Inside Driver run() method
>
>
>
>
>
--
Ashwanth Kumar / ashwanthkumar.in
Re: Best way to pass project resources in Java MR
Posted by Ashwanth Kumar <as...@googlemail.com>.
Map/Reduce task JVM has your JAR in the classpath.
Did you try "MapperClass.class.getResource("/myfile_in_jar")" ?
On Wed, Dec 16, 2015 at 8:48 PM, praveenesh kumar <pr...@gmail.com>
wrote:
> Hello folks
>
> Basic Java MR question.
>
> What is the right practice to pass any program specific files (sitting in
> src/main/resources) in your project folder to your mapper.
>
> I tried the following and it didn't work
>
> 1. Inside mapper setup() ->
>
> ClassLoader.getClassLoader().getResource("myfile_in_jar")
>
> ClassLoader.getSystemClassLoader().getResource("myfile_in_jar");
>
> 2. Inside Driver run() method
>
>
>
>
>
--
Ashwanth Kumar / ashwanthkumar.in