# Compile and run the sample project (/en/realtime-media/rtc-server-sdk/build/set-up-your-project/compile-run-sample-project/linux-java)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

This page shows you how to implement a basic Hello World program after integrating Server Gateway SDK.

1. [Create a new maven project](../../quickstart.mdx#create-a-maven-project) and [integrate the SDK](../../quickstart.mdx#integrate-the-sdk).

2. Navigate to `my-app/src` and remove the `test` folder.

   ```bash
   rm -r test
   ```

3. Open `my-app/src/main/java/com/mycompany/app/App.java` and enter the following code. Replace `Your Token` and `Your App ID` with a valid RTC SDK temporary token and your App ID.

   ```java
   import io.agora.rtc.SDK;
   import io.agora.rtc.AgoraRtcConn;
   import io.agora.rtc.AgoraService;
   import io.agora.rtc.AgoraServiceConfig;
   import io.agora.rtc.DefaultRtcConnObserver;
   import io.agora.rtc.RtcConnInfo;

   public class App {
       public static class ConnObserver extends DefaultRtcConnObserver {
           @Override
           public void onConnected(AgoraRtcConn conn, RtcConnInfo rtcConnInfo, int reason) {
           System.out.println("join success");
           }
       }

       public static void main(String[] args) throws Exception {
           String token = "Your Token";
           SDK.load(); // ensure JNI library load
           AgoraService service = new AgoraService();
           AgoraServiceConfig config = new AgoraServiceConfig();
           config.setEnableAudioProcessor(0);
           config.setEnableAudioDevice(0);
           config.setEnableVideo(0);
           config.setContext(0);
           config.setAppId("Your App ID");
           service.initialize(config);

           AgoraRtcConn conn = service.agoraRtcConnCreate(null);

           conn.registerObserver(new ConnObserver());

           conn.connect(token, "test_channel", "1");

           Thread.sleep(2000);
           conn.disconnect();
           conn.destroy();
           service.destroy();
       }
   }
   ```

   <CalloutContainer type="info">
     <CalloutDescription>
       The channel name you use to connect to the RTC SDK channel must be the same as the one you used to generate your RTC SDK temporary token. In the following code, the channel name is set to "test\_channel". If you use a different channel name to generate your RTC SDK temporary token, replace "test\_channel" with your own channel name.
     </CalloutDescription>
   </CalloutContainer>

4. Navigate to `my-app` and create a `lib` folder. Get the `linux-sdk` jar file from maven, and extract the files to the `lib` folder.

   ```bash
   mkdir lib
   cd lib
   wget https://repo1.maven.org/maven2/io/agora/rtc/linux-sdk/4.0.1/linux-sdk-4.0.1.jar
   jar xvf linux-sdk-4.0.1.jar
   ```

   <CalloutContainer type="info">
     <CalloutDescription>
       The `version` field in `dependencies` is the SDK version number, which needs to be updated according to the SDK version you integrate. For the latest SDK version number, refer to the [release notes](../../reference/release-notes.md).
     </CalloutDescription>
   </CalloutContainer>

5. Navigate to `my-app` and add the `lib/native/linux/x86_64` folder to the `LD_LIBRARY_PATH`.

   ```bash
   export LD_LIBRARY_PATH=lib/native/linux/x86_64/:$LD_LIBRARY_PATH
   ```

6. Build the project.

   ```bash
   mvn package
   ```

7. Run the app.

   ```bash
   java -cp target/agora-rtc-linux-java-1.0-SNAPSHOT.jar App
   ```

   The console prints the following information.

   ```bash
   $ java -cp target/agora-rtc-linux-java-1.0-SNAPSHOT.jar App
   join success
   ```

    
  
      
  
      
  
