Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

Commissioning an Application in Linux

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

Scenario

Run a sample program in Linux after code development is complete.

Procedure

  1. In IntelliJ IDEA, configure the Artifacts information for the project before the JAR package is generated.

    1. Enter IntelliJ IDEA and choose File > Project Structure.
    2. On the Project Structure page, select Artifacts, click the plus sign (+), and choose JAR > Empty.
      Figure 1 Add Artifacts
    3. Set the name, type, and output path of the JAR package based on site requirements.
      Figure 2 Configuring basic information
    4. Choose 'kafka-examples' compile output, right-click Put into Output Root, and click Apply.
      Figure 3 Put into Output Root
    5. Click OK to complete the configuration.

  2. Generate the JAR package.

    1. Enter IntelliJ IDEA and choose Build > Build Artifacts.
      Figure 4 Build Artifacts
    2. In the displayed interface, choose kafka-example:jar > Build to generate the JAR package.
      Figure 5 Build
    3. If log similar to the following is displayed in event logs, the JAR package is successfully generated. Obtain the JAR package from the Output directory configured shown in Figure 2
      14:37 Compilation completed successfully in 25 s 991 ms

  3. Copy the generated jar package to /opt/client/lib.

    Figure 6 File location

  4. Copy all files in the src/main/resources directory of the IntelliJ IDEA project to the src/main/resources directory at the same level as the lib folder, that is, /opt/client/src/main/resources.
  5. Ensure that the current user has read permission of all the files in the src/main/resources and lib folders in /opt/client, jdk has been installed, and java environment variables are set. Then, run the command, for example, java -cp /opt/client/lib/*:/opt/client/src/main/resources com.huawei.bigdata.kafka.example.Producer to run the example project.
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback