11

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?

root1982
  • 470
  • 2
  • 4
  • 10

3 Answers3

19

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.

zsxwing
  • 20,270
  • 4
  • 37
  • 59
15
register /local/path/to/myJar.jar
Chris White
  • 29,949
  • 4
  • 71
  • 93
3

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

pig -Dpig.additional.jars="/local/path/1/*:/local/path/2/*"
Community
  • 1
  • 1
nikoo28
  • 2,961
  • 1
  • 29
  • 39