JDK version upgrades usually introduce new language features, new APIs, and deprecate some APIs, resulting in some incompatibilities.
So when upgrading the version of the JDK used by a product, there are usually the following considerations:
- New products include new builds as well as projects that have just been launched with a high version of the JDK.
- For products in the middle of the life cycle, decisions on whether to upgrade are made based on the labor budget and the skills of the team.
- For products entering the tail end of their lifecycle, it is recommended that the existing JDK version be maintained and no upgrade work be done.
Before upgrading the JDK, a complete rundown of the change items involved will help to accurately assess the amount of work required for the upgrade.
When upgrading the JDK, evaluate the following in advance:
Purpose of upgrading the JDK version
Clarifying the purpose of the upgrade, such as improving development efficiency, improving application runtime efficiency, improving team skill readiness, explicit customer requirements, etc., helps to narrow down the set of alternative releases and make quick selection decisions.
Unify and agree on the purpose and benefits of the upgrade with the client, management team, and R&D team.
development environment (computer)
- IDE selection, currently using a low version of the IDE may not support a high version of the JDK, so you need to synchronize the updated version.
- Build tools, such as the project is currently using maven to build the product, some plug-ins may depend on the version of the JDK, so you need to synchronize the upgrade.
- Static checking tools, lower versions of which may not recognize new syntax introduced by higher versions of the JDK, need to be upgraded or re-selected.
- Debugging tools, such as memory checking and analysis tools, some Profile's tools, may need to be upgraded or re-selected in parallel.
- UT use cases, such as the Mock framework, may need to be synchronized and upgraded or re-selected, which involves the overhaul of existing UT code.
assembly line
- Streamlined software, such as Jenkins, unifies JDK versions, helping to simplify configuration of the environment while reusing the dividends from upgrading the JDK.
- The version and rules of the static checking tool, and the code static tool used in the development environment need to match, and the two need to be upgraded synchronously.
- Automated Test Cases
Product Source Code
- Compatibility changes in the source code related to languages and APIs
- Open source software, use a version that is compatible with a higher version of the JDK, or re-select a new model
- Scripts, such as installation, uninstallation, startup, stop scripts, etc.
validation exercise
- Functional verification
- Install/Uninstall/Run/Stop/Upgrade/Rewind
- business function
- performance testing
- Resource consumption, observe CPU, memory
- Business performance, e.g. throughput, latency, concurrency
- JVM performance, such as GC count, GC latency, GC logs
- Long Stability Test
Neighborhood Support System
Operations, O&M, and other systems, and work with the product to complete the correction.
Production Changes
Rehearse in advance and prepare a response plan.
Completion of the above sorting is considered a good start, the subsequent still need to formulate an implementation plan, carry out the work in an orderly manner, track the progress of each task, complete the work of upgrading within the expected time, and achieve the goal of upgrading.
AI's answer
The following is a Baidu-generated answer, the quality is not bad, the quality of the writing and wording is good.
Upgrading the JDK (Java Development Kit) is a multi-faceted process that involves version selection, dependency updates, code compatibility checks, testing, and consulting official documentation and community support. Here are some key steps and considerations:
Version Selection
- It is recommended to upgrade to the latest stable release, such as JDK 17, to take advantage of the latest performance improvements and security updates.
- Consider the compatibility of the project and the support of dependent libraries to ensure that the selected version matches the needs of the project.
Dependency Updates
- Check if the libraries that the project depends on support new versions of the JDK and update to compatible versions. Pay special attention to libraries that have mandatory dependencies, such as Zookeeper and Curator, which may require a specific version of the JDK to work properly.
- For projects that use build tools such as Maven or Gradle, update the project's build profile (e.g., or ) to specify the new JDK version.
Code Compatibility Check
- Check for the use of deprecated or no longer supported APIs in your code and modify accordingly.
- Use the IDE's hints feature to check for potential compatibility issues and fix them.
beta (software)
- Perform thorough testing after upgrades, including unit, integration, and system testing to ensure functionality is not compromised.
- Pay special attention to those functional modules that are closely related to the JDK version, such as network programming, concurrency processing, and so on.
Documentation and Community Support
- Check the official JDK documentation and community discussions for more guidance on upgrading and solutions to common problems.
- Use community forums and Q&A sites (for example) for help and advice.
By following the steps and recommendations above, the JDK upgrade process can be completed more smoothly while minimizing potential risks and problems.
bibliography
Oracle JDK
- Java Downloads
- Oracle JDK Migration Guide 22
- Oracle JDK Migration Guide 21
- Oracle JDK Migration Guide 17
- Oracle JDK Releases for Java 11 and Later
OpenJDK
- OpenJDK General-Availability Releases
- Red Hat build of OpenJDK
- JEPs in JDK 17 integrated since JDK 11
- JEP 361: Switch Expressions
- JEP 378: Text Blocks
- JEP 394: Pattern Matching for instanceof
- JEP 395: Records
- JEP 409: Sealed Classes
open source software
- Spring Framework Versions
- Spring Boot
Netizen Posts
- One of my shares - JDK17
- JDK11 upgrade JDK17 the most complete practice dry to come!
- How much faster is Java 17?
- How much faster is Java 15?
- How much faster is Java 11?
- What is the fastest Garbage Collector in Java 8?
- How much faster is Java 8?