Compiling Java class targeting 1.7 with classes built with JDK 8 on class path -
i have following scenario:
class foo references method in class bar. i'd compile class foo javac targeting java 1.7 providing bar.class binary on class path uses java 8 syntax , compiled jdk 8. in production, jre 1.7 used run application different copy of bar.class on classpath - version of class bar uses java 1.7 syntax , built jdk 7.
- assuming method signatures bar remain same, there issues compiling , running foo?
- can compile foo using jdk 7 or must use jdk 8?
for straight javac, can use -source/-target let java8 jdk build java7 class files (which means putting different version number in class file).
my builds use maven, , while jenkins server building java8, source/target specified 1.7 , run existing java7 jdk. when first dependent project migrated java8, maven pom changed build 1.8 target , forced upgrade.