main: add openjdk6 compatibility
enable with LEGACY_USE_OPENJDK6