Commissioning an Application in Linux
Scenario
Run a sample program in Linux after code development is complete.
Procedure
- In IntelliJ IDEA, configure the Artifacts information for the project before the JAR package is generated.
- Enter IntelliJ IDEA and choose File > Project Structure.
- On the Project Structure page, select Artifacts, click the plus sign (+), and choose JAR > Empty. Figure 1 Add Artifacts
- Set the name, type, and output path of the JAR package based on site requirements.
- Choose 'kafka-examples' compile output, right-click Put into Output Root, and click Apply. Figure 3 Put into Output Root
- Click OK to complete the configuration.
- Generate the JAR package.
- Enter IntelliJ IDEA and choose Build > Build Artifacts. Figure 4 Build Artifacts
- In the displayed interface, choose kafka-example:jar > Build to generate the JAR package. Figure 5 Build
- 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
- Enter IntelliJ IDEA and choose Build > Build Artifacts.
- Copy the generated jar package to /opt/client/lib. Figure 6 File location
- 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.
- 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.
Last Article: Commissioning an Application in Windows
Next Article: Kafka Streams Sample Running Guide

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.