  We combine the Fermi-LAT light curve of the BL Lacertae type blazar OJ287
with time-dependent multi-waveband flux and linear polarization observations
and submilliarcsecond-scale polarimetric images at lambda=7mm 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
millimeter-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 millimeter-wave flares originated in the
second of two features in the jet that are separated by >14pc. 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
millimeter-wave flares are cospatial and occur >14pc 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.
