Add compatibility for Java 6/7 (tested on 6u45, 7u55, 8u05)