Help Center/
MapReduce Service/
Developer Guide (Normal_3.x)/
Kafka Development Guide (Security Mode)/
Application Commissioning/
Commissioning an Application in Linux
Updated on 2022-11-18 GMT+08:00
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.
Parent topic: Application Commissioning
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.