PIG.Jar not getting created when building it

I am not seeing PIG.jar getting created after build of trunk folder as per PIG documentation to run UDFs, instead I ma seeing "pig-0.16.0-SNAPSHOT-core-h1.jar", under trunk folder.

As per below PIG doc it shud create pig.jar:


Now that we have the function implemented, it needs to be compiled and included in a jar. You will need to build pig.jar to compile your UDF. You can use the following set of commands to checkout the code from SVN repository and create pig.jar:

svn co http://svn.apache.org/repos/asf/pig/trunk
cd trunk

You should see pig.jar in your current working directory. The set of commands below first compiles the function and then creates a jar file that contains it.

cd myudfs
javac -cp pig.jar UPPER.java
cd ..
jar -cf myudfs.jar myudfs

You should now see myudfs.jar in your current working directory. You can use this jar with the script described in the previous section.

I used "pig-0.16.0-SNAPSHOT-core-h1.jar" instead of pig.jar and used above commnads.
I created myudfs folder under "/home/hadoop" and put the my udf java files uder it and ran below command & getting this error:

hadoop@hadoop:~/myudfs$ javac -cp /home/hadoop/trunk/pig-0.16.0-SNAPSHOT-core-h1.jar /home/hadoop/myudfs/Upper1.java
/home/hadoop/myudfs/Upper1.java:10: error: cannot access WritableComparable
if (input == null || input.size() == 0 || input.get(0) == null)
class file for org.apache.hadoop.io.WritableComparable not found
1 error

I am not sure if issue is at first place where pig.jar itself is not creating but snapshot jar is getting created and that's why compile is failing or if it is some other issue??

1 Answer(s)


Hi Surender,

The error shows that the class WritableComparable not found at the given package location - org.apache.hadoop.io.
Please open the jar or import the jar into eclipse and check whether package is same or not. If same please check this class is available in the jar.