Updated on 2023-06-21 GMT+08:00

Configuring a Sample Project

The huaweicloud-sdk-dis-java-X.X.X.zip package downloaded from SDK Download provides a sample project. You can use a development tool (such as Eclipse) to compile and run the sample project on a local device. You can also develop applications based on the sample project. The sample project code is available in the \dis-sdk-demo\src\main\java\com\bigdata\dis\sdk\demo directory.

Sample Code

Describes

ConsumerDemo.java

How to download data.

ProducerDemo.java

How to upload data.

Procedure

  1. Decompress the huaweicloud-sdk-dis-java-X.X.X.zip package downloaded from SDK Download to obtain the dis-sdk-demo package and sample project.
  2. Import the Eclipse project.

    1. Start Eclipse. Choose File > Import. The Import dialog box is displayed.
    1. Choose Maven > Existing Maven Projects, and click Next. The Import dialog box is displayed.
    2. Click Browse and select a root directory for the dis-sdk-demo sample project. In the Projects area, select a sample project.
      Figure 1 Import Maven Projects
    3. Click Finish.

  3. Configure the demo project.

    1. Set the project code to UTF-8.
      1. In the navigation tree on the left, right-click the required project under Project Explorer and choose Properties from the shortcut menu. The Properties for dis-sdk-demo page is displayed.
      2. In the left list, select Resource. The Resource pane is displayed.
      3. Set Text file encoding to Other. In the Others drop-down list, select UTF-8.
      4. Click Apply and Close to complete the encoding configuration.
      Figure 2 Selecting Resource
    2. Add a JDK.
      1. In the navigation tree on the left, right-click the required project under Project Explorer and choose Properties from the shortcut menu. The Properties for dis-sdk-demo page is displayed.
      2. In the left list, select Java Build Path. The Java Build Path pane is displayed.
      3. Click the Libraries tab, and then click Add Library. The Add Library dialog box is displayed.
      4. Select JRE System Library and click Next. Ensure that the version of Workspace default JRE is jdk1.8 or later.
      5. Click Finish to exit the Add Library dialog box.
      6. Click Apply and Close to add the JDK.