If you have multiple JRE installed make sure that the latest one comes first in PATH environment variable. If upgrading to Java 8 is not an option then make sure you use Java compiler's cross compilation feature and compile source code for lower Java version by using -target option of javac command. Simplest way to fix this error is install the latest Java release i.e.
Unsupported major.minor version 52.0 comes when you are trying to run a class compiled using Java 1.8 compiler into a lower JRE version e.g.