Skip to content

Instantly share code, notes, and snippets.

@AlexMAS
Last active May 5, 2026 11:56
Show Gist options
  • Select an option

  • Save AlexMAS/2bee3a338a9d466da729531016cdb007 to your computer and use it in GitHub Desktop.

Select an option

Save AlexMAS/2bee3a338a9d466da729531016cdb007 to your computer and use it in GitHub Desktop.
Chronicle Queue settings for Java 17+

The info below is valid for at least Java 25 and Chronicle Queue v2026.2.

See details in my blog or Telegram channel.

Minimal Settings

--enable-native-access=ALL-UNNAMED 
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED 
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED 
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED 
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED 
--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED 
--add-opens=java.base/java.lang=ALL-UNNAMED 
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED 
--add-opens=java.base/java.io=ALL-UNNAMED 
--add-opens=java.base/java.util=ALL-UNNAMED

Gradle Settings for tests

tasks.withType<Test>().configureEach {
    jvmArgs(
        "--enable-native-access=ALL-UNNAMED",
        "--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
        "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
        "--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
        "--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED",
        "--add-opens=java.base/java.lang=ALL-UNNAMED",
        "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
        "--add-opens=java.base/java.io=ALL-UNNAMED",
        "--add-opens=java.base/java.util=ALL-UNNAMED"
    )
}

Dockerfile Example

FROM eclipse-temurin:25.0.2_10-jdk-ubi10-minimal

ENV CQ_OPTIONS="--enable-native-access=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED"
ENV CQ_DATA_DIR=/opt/data/chronicle-queue
ENV APP_DIR=/opt

WORKDIR $APP_DIR

RUN useradd -ms /bin/bash app && \
    mkdir -p $CQ_DATA_DIR && \
    chown -R app:app $CQ_DATA_DIR && \
    chmod -R u+rwX,g+rwX $CQ_DATA_DIR && \
    chmod -R u+rwX,g+rwX $APP_DIR
USER app

...

ENTRYPOINT exec java $JVM_ARGS $CQ_OPTIONS \
    -Dfile.encoding=utf-8 \
    -jar app.jar --server.port=8080

...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment