  We combine time-dependent multi-waveband flux and linear polarization
observations with sub-milliarcsecond-scale polarimetric images at lambda=7mm of
the BL Lacertae-type blazar OJ287 to locate the gamma-ray emission in prominent
flares in the jet of the source >14pc from the central engine. We demonstrate a
highly significant correlation between the strongest gamma-ray and
millimeter-wave flares through Monte-Carlo simulations. The two reported
gamma-ray peaks occurred near the beginning of two major mm-wave outbursts,
each of which is associated with a linear polarization maximum at millimeter
wavelengths. Our Very Long Baseline Array observations indicate that the two
mm-wave flares originated in the second of two features in the jet that are
separated by >14 pc. The simultaneity of the peak of the higher-amplitude
gamma-ray flare and the maximum in polarization of the second jet feature
implies that the gamma-ray and mm-wave flares are co-spatial and occur >14 pc
from the central engine. We also associate two optical flares, accompanied by
sharp polarization peaks, with the two gamma-ray events. The multi-waveband
behavior is most easily explained if the gamma-rays arise from synchrotron
self-Compton scattering of optical photons from the flares. We propose that
flares are triggered by interaction of moving plasma blobs with a standing
shock. The gamma-ray and optical emission is quenched by inverse Compton losses
as synchrotron photons from the newly shocked plasma cross the emission region.
The mm-wave polarization is high at the onset of a flare, but decreases as the
electrons emitting at these wavelengths penetrate less polarized regions.
