Some formats may require additional support libraries to be included in your project. Below are some common formats and the corresponding libraries you may need:

XZ Support

XZ and LZMA support needs org.tukaani:xz on the class path or module path. There is no separate Compress4J artifact; the former compress4j-xz-support capability and its io.github.compress4j.xz automatic module name no longer exist, so remove them from your build and module-info.java.

On the module path, org.tukaani.xz is not resolved automatically. Add requires org.tukaani.xz; to your module, or start the JVM with --add-modules org.tukaani.xz.

  • Maven

  • Gradle Groovy

  • Gradle Kotlin

<dependency>
    <groupId>com.hominux</groupId>
    <artifactId>compress4j</artifactId>
    <version>YOUR_VERSION</version>
</dependency>
<dependency>
    <groupId>org.tukaani</groupId>
    <artifactId>xz</artifactId>
    <version>YOUR_XZ_VERSION</version>
</dependency>
dependencies {
    implementation 'com.hominux:compress4j:YOUR_VERSION'
    implementation 'org.tukaani:xz:YOUR_XZ_VERSION'
}
dependencies {
    implementation("com.hominux:compress4j:YOUR_VERSION")
    implementation("org.tukaani:xz:YOUR_XZ_VERSION")
}

Zstandard Support

Zstandard support needs com.github.luben:zstd-jni on the class path or module path. It ships native libraries for common platforms.

On the module path, com.github.luben.zstd_jni is not resolved automatically. Add requires com.github.luben.zstd_jni; to your module, or start the JVM with --add-modules com.github.luben.zstd_jni.

  • Maven

  • Gradle Groovy

  • Gradle Kotlin

<dependency>
    <groupId>com.hominux</groupId>
    <artifactId>compress4j</artifactId>
    <version>YOUR_VERSION</version>
</dependency>
<dependency>
    <groupId>com.github.luben</groupId>
    <artifactId>zstd-jni</artifactId>
    <version>YOUR_ZSTD_JNI_VERSION</version>
</dependency>
dependencies {
    implementation 'com.hominux:compress4j:YOUR_VERSION'
    implementation 'com.github.luben:zstd-jni:YOUR_ZSTD_JNI_VERSION'
}
dependencies {
    implementation("com.hominux:compress4j:YOUR_VERSION")
    implementation("com.github.luben:zstd-jni:YOUR_ZSTD_JNI_VERSION")
}

Brotli Support

Brotli support needs org.brotli:dec on the class path or module path. It only reads Brotli data; see Read-only formats.

The org.brotli:dec jar has no module descriptor, so its module name is derived from the file name (dec). On the module path, start the JVM with --add-modules dec.

  • Maven

  • Gradle Groovy

  • Gradle Kotlin

<dependency>
    <groupId>com.hominux</groupId>
    <artifactId>compress4j</artifactId>
    <version>YOUR_VERSION</version>
</dependency>
<dependency>
    <groupId>org.brotli</groupId>
    <artifactId>dec</artifactId>
    <version>YOUR_BROTLI_DEC_VERSION</version>
</dependency>
dependencies {
    implementation 'com.hominux:compress4j:YOUR_VERSION'
    implementation 'org.brotli:dec:YOUR_BROTLI_DEC_VERSION'
}
dependencies {
    implementation("com.hominux:compress4j:YOUR_VERSION")
    implementation("org.brotli:dec:YOUR_BROTLI_DEC_VERSION")
}