CQ_JVM_OPTS Example AEM | Community
Skip to main content
Level 8
June 13, 2025
Solved

CQ_JVM_OPTS Example AEM

  • June 13, 2025
  • 1 reply
  • 456 views

Hi all,

 

I need to start AEM Author with some JVM parameters using CQ_JVM_OPTS.

Could this be done using Quickstart Jar invocation using Java on command line?

Please share an example.

 

Appreciate all your replies.

 

Thanks,

Rama.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SantoshSai

@nsvsrk 

Let’s say your AEM Quickstart JAR is at C:\author\aem-author-p4502.jar.

Here’s how to do it correctly in Windows:

Step 1: Navigate to the AEM directory
cd C:\author
Step 2: Set the JVM parameters (Windows-style)
set CQ_JVM_OPTS=-Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author

This sets the CQ_JVM_OPTS variable only for the current Command Prompt session.

Step 3: Start the AEM Author instance

java %CQ_JVM_OPTS% -jar aem-author-p4502.jar 

 

1 reply

SantoshSai
Community Advisor
Community Advisor
June 13, 2025

Hi @nsvsrk,

Here's how you can do it step by step:

Step 1: Prepare Your AEM Quickstart JAR

Make sure your AEM Quickstart JAR file (e.g., aem-author-p4502.jar) is in a clean directory. This JAR file will unpack and create the crx-quickstart folder when first run.

Step 2: Set Your Desired JVM Parameters

You can set JVM parameters like heap size, garbage collector type, or system properties like run modes. These are passed using the CQ_JVM_OPTS environment variable.

Example:

CQ_JVM_OPTS="-Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author"
Step 3: Start the AEM Instance

Use the following command to start AEM, passing in the JVM parameters via CQ_JVM_OPTS:

java $CQ_JVM_OPTS -jar aem-author-p4502.jar

Alternatively, if you want to make things cleaner (especially in scripts), you can export the variable like this:

export CQ_JVM_OPTS="-Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author"
java $CQ_JVM_OPTS -jar aem-author-p4502.jar

Commonly Used JVM Options

Here are a few useful ones you might consider:

  • -Xmx4096m – Set the maximum heap size (4GB in this case)

  • -Xms2048m – Set the initial heap size

  • -XX:+UseG1GC – Use the G1 garbage collector

  • -Dsling.run.modes=author – Run the instance in Author mode

  • -Dorg.osgi.framework.bootdelegation=sun.*,com.sun.* – Sometimes used for classloading tweaks

Example Full Command

export CQ_JVM_OPTS="-Xms2048m -Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author"
java $CQ_JVM_OPTS -jar aem-author-p4502.jar

That’s it! Your AEM Author instance should now start with the custom JVM parameters you’ve defined.

Santosh Sai
nsvsrkAuthor
Level 8
June 13, 2025

Thanks Santosh.

 

Is the "Step 2: Set Your Desired JVM Parameters" executed in command line?
Let us say c:\author has aem-author-p4502.jar.

 

I could execute CQ_JVM_OPTS="-Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author" on command line like below?


c:\author>CQ_JVM_OPTS="-Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author"

 

Of course I will execute "Step 3: Start the AEM Instance" on command line only like below:

c:\author>java $CQ_JVM_OPTS -jar aem-author-p4502.jar

 

Thanks,

RK.

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
June 13, 2025

@nsvsrk 

Let’s say your AEM Quickstart JAR is at C:\author\aem-author-p4502.jar.

Here’s how to do it correctly in Windows:

Step 1: Navigate to the AEM directory
cd C:\author
Step 2: Set the JVM parameters (Windows-style)
set CQ_JVM_OPTS=-Xmx4096m -XX:+UseG1GC -Dsling.run.modes=author

This sets the CQ_JVM_OPTS variable only for the current Command Prompt session.

Step 3: Start the AEM Author instance

java %CQ_JVM_OPTS% -jar aem-author-p4502.jar 

 

Santosh Sai