Update from Java6 to Java7

Fixes #2189