This topic describes how to add Maven dependencies and download SDK tools to install Alibaba Cloud SMS SDK for Java.
Prerequisites
Before you install and use the Java SDK, make sure that the following requirements are met:
- The Java environment is installed. Java Development Kit (JDK) version 1.6 or later is used.
- An Alibaba Cloud account and AccessKey pair are created. For more information, see Obtain an AccessKey pair.
Installation methods
You can use the following two methods to install the Java SDK:
- Add Maven dependencies. This method applies to the Java projects that are managed by using Maven.
- Import JAR files to the integrated development environment (IDE). This method applies to the projects that are deployed in Eclipse or IntelliJ IDEA.
Add Maven dependencies
If you use Maven to manage Java projects, you can add Maven dependencies to the pom.xml file to install the Java SDK. In the Maven repository, you can view the Maven dependencies of Alibaba Cloud services.
Add the following Maven dependency to install the core library of the Java SDK.
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.22</version>
</dependency>
Note The version that is used in the preceding dependency is a sample version. For information about the latest version of the core library, visit the Maven repository.
Import JAR files to the IDE
Install Alibaba Cloud Java SDK by importing aliyu-java-sdk-core JAR files.
- EclipseTo install the Java SDK in Eclipse, perform the following operations:
- Download the aliyun-java-sdk-core.jar file to your project folder.
- Open your project in Eclipse, right-click the project, and choose Properties from the shortcut menu.
- In the dialog box that appears, choose to add the downloaded JAR file.
- Click Apply and Close.
- IntelliJTo install the Java SDK in IntelliJ IDEA, perform the following operations:
- Download the aliyun-java-sdk-core.jar file and decompress it to your project folder.
- Open your project in IntelliJ, choose in the menu bar, click the plus sign on the right, and select the corresponding Jar or file.
- Click Apply and then OK.