Upgrading existing Java Project from Java 1.6 to 1.8

11,547

Although Java is supposed to be backward compatible between versions, it's also known that backward compatibility in any language isn't aways as straight forward as the name suggests. Some (most) projects release it's libs versions compiled specifically targeting one or another development kit, to take advantage of new features and enhancements added to the language.

That being said, I believe the smarter way to go would be: first, update the project's JDK and rebuild it targeting the new bytecode's version. There's a chance you'll have to upgrade both Ant and (if that's your IDE of choice) Eclipse (see here why).

Second, you'll have to check for compilation errors, which will most likely lead you to update libraries conditionally to get them fixed. With those solved, you MUST run your app and see if it's running as intended; remember that compilation problems are just the top of the iceberg when the subject are dependencies.

Carefully check the app's logs looking for exceptions of any kind but mainly the ones related to class loading exceptions such as ClassCastException, ClassNotFoundException, NoClassDefFoundException, UnsatisfiedLinkError and others. If any apear, you'll have to pinpoint one by one and search for the specific solution of the specific troublemaker library.

With all that covered, you should have your app running healthily again.

One last hint, if this project of yours is still being developed, it would be a very good practice to keep the tools you use updated to their very last release. Keep also the development tools updated, like build (such as Ant, Maven, Gradle and others), JDK's and IDE's. It way easier to upgrade the pieces as they are release than to handle a mass scale upgrade :)

Share:
11,547
Jayanth
Author by

Jayanth

Updated on June 12, 2022

Comments

  • Jayanth
    Jayanth almost 2 years

    Recently I was assigned to a task wherein I have to upgrade the existing standalone java application from Java 1.6 to Java 1.8.
    I'm yet to go through the code and I have no idea about this project.

    They were using ANT 1.6.1,
    AXIS 1.5.1,
    ABINITIO 2.15,
    ORACLE 11.1.0.7,
    AUTOSYS R11,
    Java 1.6.

    I got to know that first I need to identify whether the above mentioned Tools/Frameworks are compatible with Java 1.8.

    Please suggest what are the other challenges I might encounter while compiling and building the application?