I assume you have two questions:
Use jdk8 to compile a program written for java7: Yes, java is famous for its backward-compatibility.
Use what jdk to compile a project with modules written with different source compatability: Use the lastest version. In your case, jdk8. If something went wrong, install and use multiple jdks.
EDIT: It's true that problems may come if you compile a java 7 prog with jdk8, but in my 200+ local builds and 400+ CI builds, nothing went wrong. The problem rate is so low that I merely take it into account. If you consider it INSANELY important, ALWAYS install and use the matching jdks.