Migrating from Java SE 6 to Java SE 7
By Henrik Stahl on Feb 19, 2013
Why should I migrate from SE 6 to SE 7?
The most obvious reason is that you will get access to all the new features and improvements that we have made to Java with the introduction of Java 7.
A few of these changes might require some updates to your code, but they are changes that are well worth it from a performance, quality and readability perspective. You can find more information here: http://docs.oracle.com/javase/7/docs/webnotes/adoptionGuide/index.html
Another important reason is the End of Public updates milestone for Oracle JDK 6. After February 2013, future JDK 6 updates will no longer be publicly available and old JDK 6 releases will me moved to the Java Archive. Running on an old version of Java is a bad idea, so now is the time to move to 7. For more information on the End of Public Updates milestone, see Java SE End of Life Policy
If you are unable to migrate some of your applications and need continued access to Oracle JDK 6 updates, Oracle offers long-term support through the Java SE Support program.
What do I need to do?
Option 1 – “Just run”
Java has binary backward compatibility. This means that if you have a program that has been compiled for and is running with Java SE 6, it will also run on a Java SE 7 JVM. Java SE 7 is strongly compatible with previous versions of the Java platform. Almost all existing programs should run on Java SE 7 without modification. However, there are some minor potential incompatibilities in the JRE and JDK that involve rare circumstances and "corner cases" that are documented here for completeness: http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#incompatibilities.
Option 2 – Re-compiling and modifying source code.
Most of the new features introduced with Java SE 7 are improvements on a Java code level. To benefit from these you will have to update your old source code, or use the new features in any new code you write, and recompile your code for Java SE 7.
The Netbeans IDE can help you find locations in the code where you can use some of the new features, see this link for details. Other major IDEs have similar features.
Some APIs have been marked as deprecated, which means we encourage you to use the replacement APIs instead. The deprecated APIs can be found here.
Also, some of the APIs in the sun.* packages have changed. These APIs are, and have always been, intended for internal use only and any use is “at your own risk”. It is strongly recommended to find alternatives to using these packages as soon as possible.