This topic describes how to use E-MapReduce (EMR) SDK for Java to initialize a client.

Background information

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to debug API operations and dynamically generate SDK sample code.

Before you get started

Integrate EMR OpenAPI SDK for Java into your Eclipse project.
  • Create a Maven project and add Maven dependencies.
    <dependency>
              <groupId>com.aliyun</groupId>
              <artifactId>aliyun-java-sdk-core</artifactId>
              <version>3.5.0</version>
         </dependency>
         <dependency>
              <groupId>com.aliyun</groupId>
              <artifactId>aliyun-java-sdk-emr</artifactId>
              <version>3.1.0</version>
          </dependency>
  • Download the required JAR files. In this example, Eclipse is used.
    1. Download the SDK.

      For more information, see Download links.

    2. Copy the JAR files that you downloaded to your project folder.
    3. Right-click the name of your project in Eclipse and choose Properties > Java Build Path > Add JARs.
    4. Select the JAR files that you copied in Step 2.

Initialize a client

IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<Your-AccessKeyId>", "<Your-AccessKeySecret>");
DefaultAcsClient client = new DefaultAcsClient(profile);