My default JRE in Eclipse is JDK 1.7. I also have JDK 1.6 for projects that don't need Java 7. My default compiler compliance level is naturally JDK 1.7, in accordance with the default JRE.
Now, for projects that use Java 6 (configured in Project Properties -> Java Build Path), Eclipse does not automatically use JDK 1.6 compliance under Project Properties -> Java Compiler. Instead, it uses the workspace default 1.7 which leads to the problem described here: Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0).
Is there a way to configure Eclipse to use the compiler compliance level that matches the chosen JRE (or vice versa) or do I have to manually configure both for all projects that don't use the default JRE?
Preferences -> Java -> Installed JREs -> Execution Environments
There you map installed JVMs to Java language versions (and yours probably maps the Java 6 environment to the Java 7 JVM). Afterwards set your project build path setting to that Execution Environment (not the JRE or workspace default JRE).