Update from Java6 to Java7

Fixes #2189
Merge pull request #2211 from miguelfrde/java-7

Update from Java6 to Java7