How EMT4J Simplifies Upgrading Java 8, 11, and 17 Applications

The Eclipse Migration Toolkit for Java (EMT4J) is an open‑source tool that analyzes Java projects and automates upgrades from Java 8 to 11 and from 11 to 17, offering Maven, agent, and CLI options, detailed incompatibility reports, and extensible rule sets to ease migration challenges.

Programmer DD
Programmer DD
Programmer DD
How EMT4J Simplifies Upgrading Java 8, 11, and 17 Applications

Adoptium released the Eclipse Migration Toolkit for Java (EMT4J), an open‑source Eclipse project that can analyze and upgrade Java applications, supporting migrations from Java 8 to 11 and from Java 11 to 17, with future LTS versions planned.

Many organizations recommend using the latest Java runtime for security and feature improvements, but adoption of newer versions is slow; for example, less than 49% of Java applications were on Java 11 four years after its release.

Upgrading to a newer Java version requires developers to address internal API removals, deprecated packages such as Nashorn and J2EE, API changes, and stricter access controls.

EMT4J provides a Maven plugin (currently not in Maven Central), a Java agent, and a command‑line interface to analyze project incompatibilities, outputting results in TXT, JSON, or HTML format.

To demonstrate EMT4J, consider a sample application that calls the removed Thread.stop() method:

Thread thread = new Thread();
thread.stop();

After cloning the Git repository and configuring the Maven toolchain for JDK 8 and JDK 11, the project can be built with:

mvn clean package -Prelease

This creates a .zip file in emt4j-assembly/target. After extracting, the analysis can be run, for example:

java -cp "lib/analysis/*" org.eclipse.emt4j.analysis.AnalysisMain -f 8 -t 17 \
    -o java8to17.html /home/user/application/classes

The generated HTML report lists potential issues, descriptions, suggested fixes, and locations, such as:

1.1 Removed API Back to Content
1.1.1 Description
Many of these APIs were deprecated in previous releases and have been replaced by newer APIs.
1.1.2 How to fix
See corresponding JavaDoc.
1.1.3 Issues Context
Location: file:/home/user/application/classes/App.class,
Target: java.lang.Thread.stop()V

EMT4J can also be used via the agent at application startup or through the Maven plugin during build.

The project includes rule sets for upgrading from Java 8 to 11 and from 11 to 17, such as a rule that detects usage of internal JDK APIs defined in jdk_internals.cfg (e.g., sun.nio and sun.reflect packages).

<rule desc="JDK internal API" type="reference-class" match-type="by-package" class-package-file="jdk_internals.cfg"
    result-code="JDK_INTERNAL" must-contain-in-bytecode="true" sub-result-code="@{subResultCode}" priority="p4">
  <support-modes>
    <mode>agent</mode>
    <mode>class</mode>
  </support-modes>
</rule>

The support-modes element indicates whether the rule can be applied in agent mode, class (static analysis) mode, or both. The rule’s implementation resides in the org.eclipse.emt4j.common.rule.impl package, where the ReferenceClassRule class is annotated with @RuleImpl(type = "reference-class").

Existing rules serve as examples for adding custom rules as described in the README.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

migrationAnalysisemt4j
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.