On this page

Integrate the SDK

2026-09-17

Prerequisites

The development and running environments must meet the following requirements:

  • Operating system and architecture: Linux operating system with the x86_64 architecture
  • C runtime library: glibc 2.18 or above
  • Java development tools: 64-bit JDK 8 or above, including the java, javac, and jar commands
  • Command-line tools: Bash, curl, unzip
  • Underlying dependency libraries: libasound(ALSA), libv4l2(v4l utils)
Note
  • The SDK depends on libasound (ALSA) and libv4l2 (v4l utils).
  • CentOS (RHEL/Fedora): install them by running the yum install alsa-lib-devel libv4l-devel command.
  • Ubuntu (Debian/Deepin): install them by running the apt install libasound2-dev libv4l-dev command.
  • For other platforms and systems, install them by yourself.
  • If cross-compilation is required, see the documents How to cross-compile the Linux alsa-lib dependency library? and How to cross-compile the Linux v4l-utils dependency library?, and make sure the libasound and libv4l2 dependency libraries are installed on the target machine.

You can run the following commands to check whether the server's running environment meets the requirements:

uname -m                         # Should output x86_64
getconf GNU_LIBC_VERSION          # Should be glibc 2.18 or above
java -version
javac -version

Download the SDK

See Download SDK or use the following curl command to download and extract the SDK:

curl -fL "https://artifact-sdk.zego.im/downloads/ZegoRecorder-linux-java.zip" \
    -H "Referer: https://www.zegocloud.com" \
    -o ZegoRecorder-linux-java.zip 

unzip ZegoRecorder-linux-java.zip

The extracted directory structure is as follows:

ZegoRecorder-linux-java/
    ├── VERSION.txt
    ├── Document/
    │   └── index.html
    └── Library/
        ├── ZegoRecorder.jar
        └── x86_64/libZegoRecorder.so
File or DirectoryPurposeNeeds to Be Copied to the Project
Library/ZegoRecorder.jarJava APIs and JNI bridge classesRequired for compilation and running; add it to the classpath
Library/x86_64/libZegoRecorder.soJNI native dynamic libraryRequired for running; also included during deployment
Document/Offline API documentation, open index.html to viewKeep as needed; not involved in compilation or running
VERSION.txtSDK version informationRecommended to keep for version verification

Create a Project and Import the SDK

1

Create the working directory recorder-java-integration:

mkdir -p recorder-java-integration
cd recorder-java-integration
2

Create the project under recorder-java-integration and put the SDK files into sdk/:

mkdir -p recorder-java/src/com/example recorder-java/sdk/Library/x86_64
cp sdk-download/release/Library/ZegoRecorder.jar recorder-java/sdk/Library/
cp sdk-download/release/Library/x86_64/libZegoRecorder.so recorder-java/sdk/Library/x86_64/
cp sdk-download/release/VERSION.txt recorder-java/sdk/
cd recorder-java

The project structure is as follows:

recorder-java/
    ├── src/com/example/
    └── sdk/
        ├── VERSION.txt
        └── Library/
            ├── ZegoRecorder.jar
            └── x86_64/libZegoRecorder.so
3

Create src/com/example/Main.java:

package com.example;

import com.zego.zegoliveroom.ZegoLiveRoom;

public final class Main {
    public static void main(String[] args) {
        ZegoLiveRoom sdk = new ZegoLiveRoom();
        System.out.println("Recorder SDK: " + sdk.getSDKVersion());
    }
}
4

Compile, package, and run in the recorder-java directory:

mkdir -p out/classes
javac -encoding UTF-8 -cp sdk/Library/ZegoRecorder.jar \
  -d out/classes src/com/example/Main.java
jar cfe out/recorder-app.jar com.example.Main -C out/classes .
export LD_LIBRARY_PATH="$PWD/sdk/Library/x86_64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
java -Djava.library.path="$PWD/sdk/Library/x86_64" \
  -cp "out/recorder-app.jar:sdk/Library/ZegoRecorder.jar" com.example.Main

The console printing Recorder SDK: <version> indicates the SDK is successfully integrated.

The final project structure is as follows:

recorder-java/
    ├── out
    │    ├── recorder-app.jar
    │    └── classes/com/example/
    │        └── Main.class
    ├── src/com/example/
    │    └── Main.java
    └── sdk/
        ├── VERSION.txt
        └── Library/
            ├── ZegoRecorder.jar
            └── x86_64/libZegoRecorder.so

FAQ

Check the include path or the classpath for compilation and running, and make sure the SDK for the corresponding language is used.

Check the deployment path and the dynamic library search path.

Use ldd to check the app, the SDK, and other libraries, and use an environment that satisfies all dependency requirements.

For example, check the dynamic library dependencies in the project directory:

ldd sdk/Library/x86_64/libZegoRecorder.so

If not found appears in the output, a runtime library is missing; if version ... not found appears in the output, the runtime library version does not meet the requirement. Install or update the corresponding runtime library.

Check that both the JVM and the .so library are x86_64, and make sure the JAR and the .so library are a matched pair.

Previous

Download Demo Source Code

Next

Record Single Stream

On this page

Back to top