This from a Java version mismatch. Check your Java system variables are pointing to the right version. 52 is Java 8 so both your compiler and run time must be at least this version.
The exception you have seen suggests that you are not using Java8 to execute the code. Remember that an IDE may use a different version from that at the top of your PATH.
Try this in the IDE:-. . . and both of these at the command line:-