Java licensing

How to Migrate from Oracle Java to OpenJDK: A Practical Guide

How to Migrate from Oracle Java to OpenJDK

How to Migrate from Oracle Java to OpenJDK

Migrating from Oracleโ€™s Java to an open-source Java (OpenJDK) can save costs and maintain Java support. Follow these practical steps to ensure a smooth transition:

Read Is Your Java License Agreement Expiring? 10 Things You Must Know.

1. Inventory and Analysis

Start by gathering information:

  • Identify all Java versions: Note the versions (Java 8, 11, 17, etc.) and where they run (servers, desktops, cloud).
  • List critical applications: Determine which applications or services rely on Oracle Java. Include middleware, enterprise apps, and embedded scripts.
  • Check compatibility: Review if any apps use Oracle-specific features or internal APIs. Most standard Java applications work on OpenJDK, but verify any special cases.
  • Estimate usage: If you had per-employee licensing, count how many employees actually need Java. Also consider contractors and automated systems.
  • Plan contract changes: Decide when to end Oracle Java support. Once migration is complete, you may cancel Oracle subscriptions.

For example, Company X found 300 servers running Java 8 and 100 desktops running Java 11. They planned to migrate non-critical systems first and then update support records.

2. Choose an OpenJDK Distribution

Select an OpenJDK build that fits your needs. Major options include:

  • Eclipse Temurin: Backed by the Adoptium community. Free (GPL+Classpath) and well-tested. Offers LTS builds (8, 11, 17, 21). No official Oracle branding, but widely used.
  • Amazon Corretto: Amazonโ€™s OpenJDK distribution. Free (GPL) and supported by AWS. Offers long-term support on AWS and other platforms.
  • Azul Zulu: Azul Systemsโ€™ OpenJDK. Azul is free (GPL) for community use. It also offers paid enterprise support and extended patching for older Java versions.
  • Others: Red Hat OpenJDK (part of RHEL subscription), IBM Semeru (OpenJ9 VM), SAP Machine, etc. Choose if you have an existing relationship with those vendors.
DistributionLicense/CostSupport Options
Eclipse TemurinFree (GPL+Classpath)Community support; paid vendors
Amazon CorrettoFree (GPL)AWS support; paid AWS services
Azul ZuluFree (GPL)Paid enterprise support
Oracle OpenJDKFree (GPL)Oracle support requires subscription

Match the major Java version. For example, if your apps run on Java 8, use the Java 8 builds of Temurin or Corretto. Both continue to provide security patches for Java 8 beyond Oracleโ€™s public update cut-off.

3. Set Up a Test Environment

Test the new JDKs before any production changes:

  • Parallel install: Install the chosen OpenJDK on test machines alongside Oracle Java. Point services or tests to the new JAVA_HOME.
  • Dependency analysis: Use jdeps and jdeprscan to find any code depending on internal or deprecated APIs.
  • Run full test suite: Perform integration and load tests. Verify critical use cases behave identically (check file I/O, database drivers, encryption, etc.).
  • Performance check: Measure the new JDK’s metrics (response time, throughput, GC pauses). Subtle differences in garbage collection or JIT may appear.
  • Troubleshoot: If issues arise (e.g., a visual chart looks different), adjust JVM options or upgrade libraries. Often, issues stem from deprecated classes or changed defaults.

Bugs caught during testing cost much less to fix than in production. Document all fixes so you can apply them again.

4. Plan the Migration Phases

Roll out the change in stages:

  1. Non-critical systems: Start with development, test, or secondary servers. For example, switch your build servers to use the new JDK first.
  2. Pilot group: Migrate a small group of production servers or users. Monitor these carefully for any issues.
  3. Full deployment: Once stable, update the remaining systems in controlled waves.

Communication: Inform stakeholders of the plan and timing. Schedule any downtime windows if needed. Maintain a list of systems that have yet to migrate.

Example: A Java 11 web service could be upgraded by replacing the Oracle JDK runtime with an OpenJDK build. After thorough testing confirms it works correctly, deploy the updated service across your environment.

5. Update Build and Deployment

After migration, make sure all tools use the new Java:

  • CI/CD pipelines: Update Jenkins, Azure DevOps, or GitLab CI settings to point to the new JDK installation.
  • Build tools: If you package Java with your app, replace Oracle JDK references with the new OpenJDK path.
  • Container images: Use official OpenJDK Docker images (like eclipse-temurin:11-jre) instead of Oracleโ€™s images.
  • Environment variables: Set JAVA_HOME and update the system PATH to the new JDK locations on servers and developer machines.
  • Developers: Ensure developers install the new JDK and update IDE/JDK settings. Provide a quick reference guide.

These updates prevent โ€œworks on my machineโ€ issues. Use scripts or configuration management (Ansible, Chef, Puppet) to enforce consistency.

6. Rollback Plan

Always prepare a rollback:

  • Keep the old Oracle Java installations available (do not uninstall immediately).
  • Backup relevant configuration (e.g., registry entries on Windows or environment files).
  • Schedule a maintenance window for the cutover, so you can revert without business impact.
  • Prepare scripts to switch back: e.g., reset JAVA_HOME, restore old Java commands.

A clear rollback plan ensures minimal downtime if an unexpected issue arises.

Cost Comparison Example

Migrating to OpenJDK cuts license costs. For example, consider two scenarios:

ScenarioOracle Java (Annual)OpenJDK (Annual)
1,000 employees$180,000 (+$39,600 support)$0 (community builds)
200 employees$36,000 (+$7,920 support)$0 (community builds)

Before migration, a company paying $15/employee/month for 1,000 employees paid $180k/year (plus ~$40k support). After switching to free OpenJDK, the software cost drops to $0 (though you might budget for optional support, e.g., $100 per server/year for Azul Zulu Enterprise). Even with 200 employees, saving ~$36k/year can justify the migration effort.

Migration effort vs. savings: Migration takes work (testing, updating scripts), but cost savings can be substantial. Even if migration costs some money, it can pay for itself within a year of avoided fees.

Recommendations

  • Test thoroughly: Validate your applications on the new JDK in a test environment before moving any production systems.
  • Use long-term support (LTS): For stability and longer support, stick to LTS releases (Java 8, 11, 17).
  • Document the process: Keep records of installation steps, configuration changes, and any fixes applied. This helps future audits and new team members.
  • Train your team: Inform developers and admins about the new JDK path and any differences.
  • Monitor after cutover: Check for errors or performance changes after migration. Adjust JVM settings (heap size, GC flags) if needed.
  • Plan rollbacks: Ensure you can quickly revert to Oracle Java if necessary (keeping backups and scripts).

See Also

Do you want to know more about our Oracle Java Audit Advisory Services?

Please enable JavaScript in your browser to complete this form.
Name
Author
  • Fredrik Filipsson has 20 years of experience in Oracle license management, including nine years working at Oracle and 11 years as a consultant, assisting major global clients with complex Oracle licensing issues. Before his work in Oracle licensing, he gained valuable expertise in IBM, SAP, and Salesforce licensing through his time at IBM. In addition, Fredrik has played a leading role in AI initiatives and is a successful entrepreneur, co-founding Redress Compliance and several other companies.

    View all posts