Reputation: 958
A jar is being ran with JVM 8 , which is compiled with java 6. Can this jar load another one as a 'library'/plugin that is compiled with java 8 which has dependency the first jar?
Upvotes: 1
Views: 437
Reputation: 721
Sure, it can. You can mix jars compiled against different Java versions.
Also note that there's couple of things when talking about Java version used. One is the Java Class Library you compile your code against. This defines APIs you can use in your code.
The second thing is java bytecode version. You can instruct Java 8 to compile code to be Java 6 binary compatible. This doesn't mean that your code will execute against Java 6 though. If you use calls/classes added in Java 7 or 8 then you will hit problems at runtime.
These two are the most important aspects when talking about Java compatibility. Google for Java compatibility or Java source vs. binary compatibility to get more info on the subject.
Upvotes: 1