Configuring and Importing Sample Projects
Scenario
HDFS provides sample projects for multiple scenarios to help you quickly learn HDFS projects.
The procedure for importing HDFS example codes is described as follows: Figure 1 shows the procedure.
Procedure
- Obtain the sample project folder hdfs-example-normal in the src directory where the sample code is decompressed. For details, see Obtaining Sample Projects from Huawei Mirrors.
- Import the example project to the IntelliJ IDEA development environment.
- Open IntelliJ IDEA and choose .
- Choose the directory of the example project hdfs-example-normal. Click OK.
- Add the conf directory in the project to the resource path. On the menu bar of the Intellij IDEA, choose File > Project Structure. In the dialog box that is displayed, select the current project and click Resources > conf > OK to set the resource directory. The figure shows the directory for setting the project resource. Figure 2 Setting the Project Resource Directory
- Add the related jar files the example project depending on into classpath.
If the sample project code is obtained from Huawei Mirrors, the related JAR packages will be automatically downloaded after Maven is configured. You do not need to manually add the JAR packages.
- (Optional) When running SmallFS example code, you need import the dependent xml files for the example project. Copy smallfs-site.xml from the downloaded client decompressed folder SmallFS\config to the conf folder in the hdfs-example-normal project.Figure 3 Importing smallfs-site.xml
- Set the IntelliJ IDEA text file coding format to prevent garbled characters.
- On the IntelliJ IDEA menu bar, choose File > Settings.
- Choose Editor > File Encodings from the navigation tree of the Settings window. In the "Global Encoding" and "Project Encodings" area, set the value to UTF-8, click Apply, and click OK, as shown in Figure 4
Last Article: Development and Operating Environment
Next Article: Developing the Project


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