Thursday, 31 July 2025

Java LTS Versions Compared: Java 8 vs 11 vs 17 vs 21

 Java has come a long way since Java 8, and with each Long-Term Support (LTS) release, the language and platform have evolved significantly. Whether you're a developer, architect, or team lead, understanding the differences between Java LTS versions can help you choose the right version for your project.

In this blog post, we'll compare the major LTS versions: Java 8, 11, 17, and 21 — highlighting their key features, improvements, and what makes each version special.


☕ Java 8 (LTS) — March 2014

Major Features:

  • ✅ Lambda Expressions (functional programming)

  • ✅ Streams API

  • ✅ Default Methods in Interfaces

  • java.time package (modern date/time API)

  • ✅ Optional<T> to reduce null checks

  • ✅ CompletableFuture for async programming

🔍 Why it matters: Java 8 was a revolution — introducing functional-style programming and new APIs that changed how Java is written.


☕ Java 11 (LTS) — September 2018

Major Features:

  • ✅ Local-variable syntax for lambdas

  • ✅ New HTTP Client (supports HTTP/2)

  • ✅ New String methods: isBlank(), lines(), repeat()

  • ✅ File I/O improvements: readString(), writeString()

  • ✅ Single-file source-code launcher: java Hello.java

  • ❌ Removed outdated modules: CORBA, Java EE

🔍 Why it matters: Java 11 brought performance gains and cleaner syntax, making it a solid upgrade target from Java 8.


☕ Java 17 (LTS) — September 2021

Major Features:

  • ✅ Sealed Classes – Control class inheritance

  • ✅ Pattern Matching for instanceof

  • ✅ Records – Concise data classes

  • ✅ Switch Expressions – More powerful and expressive

  • ✅ Text Blocks – Multiline strings with ease

  • ✅ New Random Number Generators API

🔍 Why it matters: Java 17 improves readability, reduces boilerplate, and introduces more expressive language features.


☕ Java 21 (LTS) — September 2023

Major Features:

  • ✅ Virtual Threads – Lightweight threads for high concurrency (Project Loom)

  • ✅ Pattern Matching for switch (Finalized)

  • ✅ Structured Concurrency – Simplified thread orchestration

  • ✅ Record Patterns – Pattern matching with records

  • ✅ Sequenced Collections – Ordered collection APIs

  • ✅ Scoped Values (Preview) – Better than thread-local

  • ✅ Simpler main methods with unnamed classes (Preview)

🔍 Why it matters: Java 21 is a game-changer for scalability and concurrency, especially in cloud-native and high-performance applications.

Recommendation: For new projects, use Java 21. For existing Java 8 projects, consider upgrading to at least Java 17.

💬 Have you already upgraded to Java 17 or 21? Share your experience in the comments below! 

Wednesday, 28 May 2025

Retag an existing ECR image

Sometimes you need to retag an existing AWS ECR (Elastic container registry) image to the latest in order to deploy it as the latest.

 
Use Power shell for these commands

1. Get a Specific Image from ECR by Digest


$Image = Get-ECRImageBatch -ImageId @{ imageDigest="sha256:5cf0bd5fa566c49bba44e9fab18bf340bff5f3ef224217a6f13e43321ce9" } -RepositoryName jagdev-poc/service


2. Extract the Image Manifest


$Manifest = $Image.Images[0].ImageManifest


3. Re-tag the Image with "latest"


Write-ECRImage -RepositoryName jagdev-poc/service -ImageManifest $Manifest -ImageTag latest


4. List All Images in the Repository

Get-ECRImage -RepositoryName jagdev-poc/service