Configuring Sample Projects

Download the dis-sdk-1.2.3.zip package from the URL noted in section Downloading SDKs. The package provides a sample project. You can use a development tool (such as Eclipse) on the local server to compile and run the sample project. You can also develop your applications based on the sample project. The sample project code is available in the \dis-sdk-demo\src\com\bigdata\dis\sdk\demo directory.

Sample Code

Description

ConsumerDemo.java

How to download data

ProducerDemo.java

How to upload data

Procedure

  1. Decompress the dis-sdk-1.2.3.zip package obtained in Downloading SDKs to obtain the dis-sdk-demo package and sample project.

  2. Import the Eclipse project.

    1. Start Eclipse and choose File > Import. The Import dialog box is displayed.

    2. Choose General > Existing Projects into Workspace and click Next. The Import dialog box is displayed.

    3. Click Browse and select a save location for the dis-sdk-demo sample project. In the Projects area, select a sample project, as shown in Figure 1.

      **Figure 1** Import Projects

      Figure 1 Import Projects

    4. Click Finish to import the project.

  3. Configure the demo project.

    1. Set the project code to UTF-8.

      1. In the navigation tree, right-click the required project under Project Explorer and choose Properties from the shortcut menu. The Properties for dis-sdk-demo dialog box is displayed.

      2. In the navigation tree, choose Resource. The Resource page is displayed in the right pane.

      3. In the Other drop-down list, select UTF-8.

      4. Click Apply and Close.

      **Figure 2** Resource

      Figure 2 Resource

    2. Import a JAR dependency package.

      1. In the navigation tree, right-click the required project under Project Explorer and choose Properties from the shortcut menu. The Properties for dis-sdk-demo dialog box is displayed.

      2. In the navigation tree, choose Java Build Path. The Java Build Path page is displayed in the right pane.

      3. Click the Libraries tab, and then click Add External JARs. The JAR Selection dialog box is displayed.

      4. Select the location of the dis-sdk folder in the decompressed dis-sdk-1.2.3 file, and then click Open.

      5. On the Properties for dis-sdk-demo page, click Apply and Close to import all the .jar files in the current path and the third_lib folder to the project.

      **Figure 3** Java Build Path

      Figure 3 Java Build Path

    3. Add the JDK.

      1. In the navigation tree, right-click the required project under Project Explorer and choose Properties from the shortcut menu. The Properties for dis-sdk-demo dialog box is displayed.

      2. In the navigation tree, choose Java Build Path. The Java Build Path page is displayed in the right pane.

      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. Verify 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.