This topic describes how to install ECS SDK for Java and the Alibaba Cloud SDK core library.

Prerequisites

JDK 1.6 or later must be installed before you install ECS SDK for Java.

Background information

The Alibaba Cloud Developer Center provides ECS SDK for Java, and Maven project dependencies and JAR packages of the Alibaba Cloud SDK core library. You can write code to call Alibaba Cloud SDKs to access Alibaba Cloud products and services.

This example uses Windows 10 64-bit as the operating system and uses IntelliJ IDEA as the Java development tool.

Procedure

  1. Choose one of the following ways to configure the Maven project management tool in IDEA:
    • Use the integrated Maven project management tool in IDEA.
    • Download the Maven software corresponding to the operating system from the official Maven website (Download Apache Maven) and manually configure the Maven tool.
  2. Go to Alibaba Cloud SDKs to obtain the Alibaba Cloud SDK core library and Maven dependencies of ECS.
  3. Create a Maven project by using one of the following methods:
    • Method 1: Create a Maven project in IDEA.create
    • Method 2: Convert an existing project to a Maven project.
      1. Right-click the project to be converted and choose Add Framework Support... from the shortcut menu.add
      2. Select Maven and click OK.maven
  4. Add the aliyun-java-sdk-core, aliyun-java-sdk-ecs, and fastjson dependencies to the pom.xml file under the project directory.
    After the dependencies are added, the Maven project management tool automatically downloads the corresponding JAR packages.
    <dependencies>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>4.4.3</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-ecs</artifactId>
            <version>4.17.1</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.60</version>
        </dependency>
    </dependencies>
  5. Check External Libraries under the project directory.
    If the output in the following figure is generated, the dependencies are imported.jar