Following things I did::

1) I went into the hadoop diectory- the path is
/home/hadoop/Softwares/hadoop0.19.0
2) Then I made a folder named Try under the above path. I added all the jars
under lib directory and the bin folder in which, my code lies. This bin
folder got created under the eclipse's wrkspace.
3) Since I just need to try the execution of sample code thro' hadoop's
prompt, I wrote a code as::

package h.pkg;

public class PC {
    public static void main(String[] args) {
System.out.println("A trial code thro' hadoop propmt..!!");    }
}
4) Thus, this entire package under bin of eclipse's wrkspace was placed in
the Try folder.
5) Then, there was MANIFEST.MF consisting of following content::
Manifest-Version: 1.0
Created-By: 1.6.0_14 (Sun Microsystems Inc.)
Main-Class: h.pkg.PC
6) After the above, I simple built a jar as follows::

/home/hadoop/Softwares/hadoop>  jar cfmv Sample.jar MANIFEST.MF -C Try/ .
(the propmt)
7) Thus, the jar was built, as I could see all the contents getting added
into it...
8) Then I simply did try 2 run it as::/home/hadoop/Softwares/hadoop>
bin/hadoop jar Sample.jar
9) It gave me following errors::

ad...@hadoop:~/Softwares/hadoop-0.19.0$ bin/hadoop jar H.jar
java.lang.ClassNotFoundException: h.pkg.PC
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:158)
    at org.apache.hadoop.mapred.JobShell.run(JobShell.java:54)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
    at org.apache.hadoop.mapred.JobShell.main(JobShell.java:68)

10) Please suggest for the above!



Regards!
Sugandha


On Fri, Jun 18, 2010 at 7:32 AM, Raghava Mutharaju <
[email protected]> wrote:

> did you use the following?
>
> bin/hadoop jar <JarFilename> <fullyQualifiedClassName>
>
> Raghava.
>
> On Thu, Jun 17, 2010 at 9:21 PM, Sugandha Naolekar
> <[email protected]>wrote:
>
> > I need to execute a code through the propmt of hadoop,i.e; bin/hadoop>.
> > So, I built the jar of it using jar cfmv Jarfile_name Manifest_filename
> -C
> > directory_name/ .(in which d jars,and class files are added).
> > After that, I simply execute the code thro' bin/hadoop Jarfilename.
> >
> > But, I get an error of Class Not found exception.
> >
> > Can I please get the entire procedure of building a jar and then running
> it
> > through prompt??
> >
> >
> > Regards!
> > Sugandha
> >
>

Reply via email to