Java – does programming with JDK 7 allow applications to run on JRE 6?
I program in eclipse I will never change eclipse's default compilation settings or anything else
If JDK 7.0 is installed on my computer If the runnable jar I compiled has any problems running on the older JRE, suppose the old JRE supports all my program functions?
For example, if I write an application in eclipse and install the latest JDK – should the application run on a slightly older JRE?
If the answer is "yes" – how can I change? How do I allow my programs to run on jres older than my JDK? thank you
Solution
Your code can only run on JRE 6. Compile it for JRE 6 Check your compiler settings (Project - > properties - > java compiler) and make sure you compile for Java 6, otherwise users will get unsupported classversionerror if they do not have Java 7.0 installed
You must also ensure that you do not use any Java 7 functions (such as java.nio.path), or install Java 6 JDK and use it to compile your application, otherwise you will lose the application on Java 6 with method / class exceptions at runtime (you will get compile time errors when using JDK 6)