I don't know if there's an elegant way to do this, but the following could work.
Reorganize and refactor your codebase into two parts:
- the part that needs to work in the the Java 6 version of your codebase, and
- the other code that is specific to the Java 7 version. (This is likely to involve creating some Java interfaces with Java 6 and Java 7 specific implementation classes.)
Put the Java 6 and Java 7 code into separate Eclipse Java projects. Set the Eclipse project preferences to select the appropriate Java compliance level for each project; e.g. "Project > Properties > Java Compiler" ...
If you haven't already done so, further refactor the code so that the Java 6 and Java 7 specific classes are dynamically loaded by the core; e.g. using
Class.forName(...)
This should allow you to develop the Java 6 and Java 7 parts in the same Eclipse workspace.
You should also be able to use "Run > Run Configurations" and/or "Run > Debug Configurations" to create launchers for Java 6 and Java 7 for in-Eclipse testing.
Note: I've not tried this myself. Please let us know if it works.