Updated on 2022-11-18 GMT+08:00

Configuring and Importing a Sample Project

  1. Obtain the sample project folder kafka-examples in the src directory where the sample code is decompressed. For details, see Obtaining Sample Projects from Huawei Mirrors.
  2. Configure the krb5.conf and user.keytab files.

    Copy the krb5.conf and keytab files obtained in Preparing the Developer Account section and all the cluster configuration file obtained in section Preparing an Operating Environment to the kafka-examples\src\main\resources directory of the sample project.

  3. After installing the IntelliJ IDEA and JDK tools, configure JDK in IntelliJ IDEA.

    1. Open IntelliJ IDEA and click Configure.
      Figure 1 Quick Start
    2. Choose Project Defaults > Project Structure.
      Figure 2 Configure

    3. In the displayed Project Structure for New Projects interface, click SDKs. Then click the plus sign (+) and choose JDK.
      Figure 3 Project Structure for New Projects
    4. In the displayed Select Home Directory for JDK interface, select the JDK directory, and click OK.
      Figure 4 Select Home Directory for JDK
    5. Click OK.
      Figure 5 Completing the JDK configuration

  4. Import the sample project into the IntelliJ IDEA development environment.

    1. Choose Open.

      The dialog box for browsing directories is displayed.

    2. Select the sample project folder and click OK.

  5. Set the IntelliJ IDEA text file coding format to prevent invalid characters.

    1. On the IntelliJ IDEA menu bar, choose File > Settings.

      The Settings window is displayed.

    2. Choose Editor > File Encodings in the navigation tree. In the Project Encoding area and Global Encoding area, set the parameter to UTF-8, click Apply, and then click OK, as shown in Figure 6.
      Figure 6 Setting the IntelliJ IDEA coding format