Question

If I compile with my java7 jdk, I get a jar which runs fine with java7 but obviously fails to load with java6. If I compile with my java7 jdk but specify the output to be compatible with java6, it runs fine on both a java6 jre and a java7 jre.

My question is, is the first jar somehow "better" (faster, more efficient, more optimised) for running in a java7 jre than the second one? Is there any disadvantage for the user of a java7 jre to use the second one, or is this second jar good enough for everybody to use?

My reasoning is, I want the result to be as good as possible for java7 users, but I need something which can be run on java6. So do I need to provide two jars or just the java6 one?

Was it helpful?

Solution

Obviously, if you compile and run your code on Java 6 you cannot use classes that have been added to Java's standard library in Java 7, because those will not be present on Java 6.

For the rest, there is no practical difference at all. Almost all optimization is done during runtime by the JVM and the JIT; the Java compiler does almost no optimization.

OTHER TIPS

I don't think there is any different if you don't use any the new API from Java 7. I'm not 100% sure on this, I think if your program is compiled using Java 6, it will still benefit from the speed boost from people running on Java 7 VM.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top