Sidebar

Migrating From JDK 8 to JDK 17 and why it's important

+1 vote
1.2K views
asked Nov 3, 2023 by nathan-c-4426 (540 points)
edited Nov 3, 2023 by nathan-c-4426

I just got an alert that I need to upgrade my java version.  What are the steps I need to take and why?

1 Answer

+1 vote
 
Best answer

Migrating From JDK 8 to JDK 17 and why it's important

In the ever-evolving landscape of software development, staying current with the latest technologies is essential to remain competitive and ensure the longevity of your applications. The transition from Java Development Kit (JDK) 8 to JDK 17 represents a significant step forward in the world of Java, and it's a change that's not just important but imperative for the modern developer.

JDK 8, with its introduction of lambdas, the Stream API, and other groundbreaking features, was a game-changer in Java development. However, as technology advances, so do the tools we use to build it. JDK 17 brings a host of new features and improvements that address the evolving needs of the Java community, making it a compelling choice for migration.

One of the key reasons for migrating to JDK 17 is long-term support (LTS). Unlike JDK 8, which has reached its end of public updates, JDK 17 is a long-term support release, ensuring stability and security updates for a more extended period. This means fewer concerns about vulnerabilities and more time to focus on innovation.

Additionally, JDK 17 boasts performance enhancements, reduced memory consumption, and improved code readability, all of which can lead to more efficient and maintainable code. Enhanced APIs, pattern matching, and sealed classes further streamline development, making your code more robust and expressive.

Furthermore, migration paves the way for taking full advantage of the latest language features and APIs, such as records, local-variable type inference, and the new packaging system. Embracing these features not only simplifies code but also fosters a more agile and productive development environment.

In a rapidly evolving technological landscape, migrating from JDK 8 to JDK 17 is not just about keeping up; it's about staying ahead. It's about leveraging the latest tools and technologies to create more efficient, secure, and maintainable Java applications. So, if you're still on JDK 8, it's time to embark on this exciting journey to a brighter Java future with JDK 17.

Since a primary driving force behind all software upgrades is enhanced security, Java has introduced some additional modular security and is actually still in the process of modularizing all of their internal libraries. While this is great for security it can be problematic for 3rd party libraries that rely on the internal objects and components. Java has provided a clear way to specify access to these components and so we'll need to specify access to these components via some configuration parameters. These parameters might vary according to the 3rd party libraries in use in your system. Additional reading if the topic interests you can be found here: https://docs.oracle.com/en/java/javase/17/migrate/migrating-jdk-8-later-jdk-releases.html#GUID-7744EF96-5899-4FB2-B34E-86D49B2E89B6

Steps to upgrading

  1. 1. Install a flavor of Java 17 on your servers. We primarily use OpenJdk for our unit test suites, however we also test Amazon-Coretto's JDK and Oracle's is a great choice as well if you have an existing license agreement with them.
  2. 2. Add the necessary parameters for your system. On Windows Servers you'll use the QIE Service Manager. On Unix systems you'll add these to the qie.service definition.

These are needed for QIE to run

--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED

This is needed to parse a raw x509Certificate (used in creating a SAML signature)

--add-opens=java.base/sun.security.x509=ALL-UNNAMED

These are needed to generate a SAML signature

--add-opens=java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED
--add-opens=java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED

This is needed to validate a SAML signature

--add-opens=java.xml.crypto/org.jcp.xml.dsig.internal.dom=ALL-UNNAMED

This option is needed to output the base64 encoded certificate as a single line when generating the SAML signature

-Dorg.apache.xml.security.ignoreLineBreaks=true

image

answered Nov 3, 2023 by brandon-w-8204 (33,330 points)
edited Nov 3, 2023 by nathan-c-4426
...