Choosing the correct Java version for your AEM installation is critical for stability and performance. This guide provides comprehensive compatibility information for AEM 6.5 and AEM as a Cloud Service, including supported JDK distributions and configuration best practices.
AEM Java Compatibility Matrix
Here's the definitive compatibility matrix for AEM versions and Java:
| AEM Version | Minimum Java | Recommended Java | Maximum Java |
|---|---|---|---|
| AEM Cloud Service (2025+) | Java 11 | Java 21 | Java 21 now recommended |
| AEM 6.5.17+ (LTS) | Java 11 | Java 11 | Java 11 |
| AEM 6.5.13 - 6.5.16 | Java 11 | Java 11 | Java 11 |
| AEM 6.5.0 - 6.5.12 | Java 8 | Java 11 | Java 11 |
| AEM 6.4 (EOL) | Java 8 | Java 8 | Java 8 |
As of 2025, Java 21 is now the recommended runtime for AEM as a Cloud Service SDK.
⚠️ Important: LTS Versions Only
AEM only supports Long-Term Support (LTS) Java versions. Do not use non-LTS versions like Java 12, 13, 14, 15, 16, 18, 19, or 20 in production.
Supported JDK Distributions
AEM supports several JDK distributions. Here are the recommended options:
Oracle JDK
The original Java distribution from Oracle:
- Pros: Official Oracle support, well-tested
- Cons: Commercial license required for production use since Java 11
- Cost: Subscription-based pricing
Azul Zulu (Recommended)
Adobe's recommended distribution for AEM:
- Pros: Free for commercial use, TCK certified, excellent support
- Cons: Paid support options available but not required
- Download: azul.com/downloads
Eclipse Temurin (AdoptOpenJDK)
Community-driven OpenJDK distribution:
- Pros: Free, open source, wide community support
- Cons: Community support only
- Download: adoptium.net
Amazon Corretto
Amazon's OpenJDK distribution:
- Pros: Free, backed by Amazon, includes patches
- Cons: Optimized for AWS environments
- Download: aws.amazon.com/corretto
Adobe's Official Recommendation
Adobe recommends Azul Zulu for AEM deployments. It's the distribution tested internally by Adobe and used in AEM as a Cloud Service.
AEM 6.5 Java Configuration
Setting JAVA_HOME
Configure JAVA_HOME correctly for your operating system:
# macOS/Linux - Add to ~/.bashrc or ~/.zshrc
export JAVA_HOME=/path/to/jdk-11
export PATH=$JAVA_HOME/bin:$PATH
# Verify installation
java -version
echo $JAVA_HOME
# Windows - Set environment variable
setx JAVA_HOME "C:\Program Files\Java\jdk-11"
setx PATH "%JAVA_HOME%\bin;%PATH%"
JVM Arguments for AEM 6.5
Recommended JVM arguments for production:
# Recommended startup script for AEM 6.5
java -Xmx4096m -Xms4096m \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/path/to/dumps \
-Djava.awt.headless=true \
-jar aem-author-p4502.jar
Memory Allocation Guidelines
| Environment | Minimum Heap | Recommended Heap | Max Heap |
|---|---|---|---|
| Local Development | 1GB | 2-4GB | 8GB |
| Author (Production) | 4GB | 8-16GB | 32GB |
| Publish (Production) | 4GB | 8-16GB | 32GB |
AEM Cloud Service Java Configuration
Local SDK Requirements
For local development with AEM Cloud SDK:
# Check your Java version matches Cloud Manager
java -version
# Should output: openjdk version "11.x.x" or "17.x.x"
# Start SDK with appropriate memory
java -Xmx2g -jar aem-author-p4502.jar
Cloud Manager Java Version
AEM Cloud environments use a specific Java version that you cannot change directly. Check your environment's Java version in Cloud Manager under Environment Details.
Troubleshooting Java Issues
"Unsupported major.minor version" Error
This error indicates a Java version mismatch:
Error: A JNI error has occurred
java.lang.UnsupportedClassVersionError: org/apache/sling/launchpad/app/Main
has been compiled by a more recent version of the Java Runtime (class file version 55.0)
Solution: Ensure your JAVA_HOME points to the correct Java version. Class file version 55.0 = Java 11.
JAVA_HOME Not Set Correctly
# Diagnose JAVA_HOME issues
echo $JAVA_HOME
which java
java -version
# Fix: Set JAVA_HOME explicitly
export JAVA_HOME=$(/usr/libexec/java_home -v 11) # macOS
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk # Linux
Multiple Java Versions Conflict
When multiple Java versions are installed:
# macOS - List all installed Java versions
/usr/libexec/java_home -V
# Use jenv for version management (recommended)
brew install jenv
jenv add /path/to/jdk-11
jenv global 11
# Or use SDKMAN
curl -s "https://get.sdkman.io" | bash
sdk install java 11.0.21-zulu
sdk use java 11.0.21-zulu
Bonus: Git Commit & Push Script for Windows
When working on AEM projects, you'll frequently need to commit and push code changes. This PowerShell script automates the entire process — setting your git identity, staging changes, committing, and pushing — all in one command.
Why Use This Script?
- One Command: Replaces multiple git commands (
git add,git commit,git push) with a single script - Consistent Identity: Automatically sets your name and email for every commit
- Error Handling: Checks if you're in a git repository before running
- Time Saver: Perfect for rapid development cycles in AEM projects
PowerShell Script (commit.ps1)
Save this as commit.ps1 in your project folder:
Param(
[Parameter(Mandatory = $true)]
[string]$Message,
[string]$Name = "Tharun Wegworks",
[string]$Email = "[email protected]"
)
# Ensure you are inside a Git repo
if (-not (Test-Path ".git")) {
Write-Host "❌ Not a Git repository. CD into your repo folder first."
exit 1
}
# Set identity for this repo
git config user.name $Name
git config user.email $Email
Write-Host "✅ Using identity: $Name <$Email>"
# Stage all changes
git add -A
Write-Host "📦 Staged all changes"
# Commit with the provided message
git commit -m $Message
Write-Host "✔️ Committed: $Message"
# Push to remote
git push
Write-Host "🚀 Pushed to remote successfully!"
How to Use
- Save the script: Copy the code above and save it as
commit.ps1 - Open PowerShell: Navigate to your AEM project directory
- Run the script:
.\commit.ps1 -Message "Your commit message here"
⚠️ PowerShell Execution Policy
If you get an execution policy error, run this command first:Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
💡 Customize Your Identity
The script uses default values for name and email. You can override them:.\commit.ps1 -Message "Fix bug" -Name "Your Name" -Email "[email protected]"
Need AEM Support?
WegWorks provides expert AEM consulting, including environment setup, performance tuning, and Cloud migration. Contact us for assistance.