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¶
Decompress the dis-sdk-1.2.3.zip package obtained in Downloading SDKs to obtain the dis-sdk-demo package and sample project.
Import the Eclipse project.
Start Eclipse and choose File > Import. The Import dialog box is displayed.
Choose General > Existing Projects into Workspace and click Next. The Import dialog box is displayed.
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.
Click Finish to import the project.
Configure the demo project.
Set the project code to UTF-8.
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.
In the navigation tree, choose Resource. The Resource page is displayed in the right pane.
In the Other drop-down list, select UTF-8.
Click Apply and Close.
Import a JAR dependency package.
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.
In the navigation tree, choose Java Build Path. The Java Build Path page is displayed in the right pane.
Click the Libraries tab, and then click Add External JARs. The JAR Selection dialog box is displayed.
Select the location of the dis-sdk folder in the decompressed dis-sdk-1.2.3 file, and then click Open.
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.
Add the JDK.
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.
In the navigation tree, choose Java Build Path. The Java Build Path page is displayed in the right pane.
Click the Libraries tab, and then click Add Library. The Add Library dialog box is displayed.
Select JRE System Library and click Next. Verify that the version of Workspace default JRE is jdk1.8 or later.
Click Finish to exit the Add Library dialog box.
Click Apply and Close.