
So, switching to Java8 also carries a (minimal) risk of running into that kind of problem. I saw some questions here about (rare) situations where Java8 refused to compile Java7 code.Increasing your knowledge can help in making informed decisions.
#Java 8 jre code#
So, even when you don't intend to modify your code base today, switching to Java8 could tell you about such things. And that could eliminate the need for annotations in your current code base (and when such annotations are no longer required, the compiler warns about that).


Example: type inference has been greatly improved with Java8. When you switch to Java8, you might find additional warnings being emitted by javac. The byte code is basically the same, even the support for invokedynamic which was added for lambdas existed in Java 7 but just wasn't used that way. Other minor differences are the magic number at the start of the file, possibly the order of the constant pool. The only subtle difference is that there have been minor differences to the Java API, so there might be very subtle differences the Java 8 compiler might find that the Java 7 If you are asking whether there is any benefit in re-compiling Java 7 code in a Java 8 compiler, the answer is almost nothing. Is there any technical benefit to upgrading the compiled code to the latest Java 8 JDK?

However, it might be slower for your use case so the only way to know is to test it. Java 8 might be faster, and it has better support for new features like G1. The main benefit is that Java 8 has the latest bug fixes where as Java 7 isn't being publicly updated.Īlso if you are going to run code on an Java 8 JVM, you may as well have just one version of Java installed.
