Getting error when running pig: Cannot locate pig-core-h2.jar. do 'ant -Dhadoopversion=23 jar', and try again

1.7k views Asked by At

So I installed pig last night, decompressed the tar, and also edited my .bashrc to include:

export PIG_HOME=/usr/lib/pig/pig-0.12.0 
export PATH=$PATH:$PIG_HOME/bin 

Last night I ran pig -h, ran some load commands, etc. it was working perfectly. Now this morning I try to run any pig command and it gives me the following error:

Cannot locate pig-core-h2.jar. do 'ant -Dhadoopversion=23 jar', and try again

So I try to run ant -Dhadoopversion=23 jar and I get this:

-bash: ant: command not found

My question is: why was it running find last night but this morning it won't work? What am I doing wrong? And also - do I have to somehow reinstall ant? I went to /usr/local/bin/ and there is no ant directory. I also run ant -version and I get command not found.

But why was it working last night? What's different now?

1

There are 1 answers

0
glefait On

this error come from the pig binary:

 if [ -f $PIG_HOME/pig.jar ]; then
    PIG_JAR=$PIG_HOME/pig.jar
else
    PIG_JAR=`echo $PIG_HOME/pig-?.!(*withouthadoop).jar`
fi

if [ -n "$PIG_JAR" ]; then
    CLASSPATH="${CLASSPATH}:$PIG_JAR"
else
    echo "Cannot locate pig.jar. do 'ant jar', and try again"
    exit 1
fi

Your variable $PIG_HOME is therefore undefined and for some reason could not been set automatically. Just do:

export PIG_HOME=/path_to_your_pig