Add a hack to construct SciJava's context robustly

When ImageJ2's LegacyInitializer was found on the class path, it tries
to initialize a SciJava Context. If that fails, no context is installed,
and when that happens inside a Fiji installation, all of Fiji's runtime
patches are skipped.

Clearly, we want to do our best to prevent that from happening.

So when SciJava's Context cannot be created, let's try again with a
Context narrowed down to ImageJ2's DefaultLegacyService.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Patch LegacyClassLoader lazily inside LegacyEnvironment

It is no good if the LegacyClassLoader is patched at constructor time.
We might want to configure this or that before doing that, but after
instantiating the LegacyClassLoader.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Re-add classes with deprecated package name

This is required for a smooth upgrade path between ij1-patcher versions.
TrackMate, for example, depends on a newer fiji-lib, which in turn
depends on a newer ij1-patcher. But TrackMate does not (yet) depend on
ImageJ2, therefore installing bleeding-edge TrackMate into an existing
Fiji.app/ would completely disrupt the startup.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Remove the deprecated JavaAgent again

We really do not need the Java Agent in the old package.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Back-port "Add a hack to construct SciJava's context robustly"

This patch was made to try extra-hard when creating a SciJava context.
We should do the same even when using the classes in the deprecated
package. Actually, we should do it *especially* then because we already
know that there is version skew in that case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge branch 'backwards-compatibility'

This branch introduces almost overzealous code trying almost desperately
to provide backwards-compatibility even in pathological cases where
version skew was introduced (which is all too easy!).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>