root1982
root1982

Reputation: 470

how to include external jar file using PIG

When I run a mapreduce job using hadoop command, I use -libjars to setup my jar to the cache and the classpath. How to do something like this in PIG?

Upvotes: 11

Views: 17586

Answers (3)

nikoo28
nikoo28

Reputation: 2971

An extension to zsxwing's answer.
You can also specify multiple jar paths as

pig -Dpig.additional.jars="/local/path/1/*:/local/path/2/*"

Upvotes: 3

zsxwing
zsxwing

Reputation: 20826

There are two ways to add external jars to Pig environment.

  1. Use "-Dpig.additional.jars" to start Pig

    pig -Dpig.additional.jars=/local/path/to/your.jar

  2. Use "register" command in Pig scripts or grunt

    register /local/path/to/your.jar;

You can use any one according to your requirement.

Upvotes: 19

Chris White
Chris White

Reputation: 30089

register /local/path/to/myJar.jar

Upvotes: 15

Related Questions