Install the SLS SDK for Java via Maven (recommended) or by manually importing the JAR package.
Prerequisites
-
Simple Log Service is activated. Activate Simple Log Service.
-
A Java development environment is installed.
The SLS SDK for Java requires JRE 6.0 or later. Run java -version to check your version. If Java is not installed, download it from the official Java website.
Install the SDK
Install the SLS SDK for Java using one of the following methods:
-
Method 1: Add a dependency to your Maven project (Recommended)
Add the following dependency to the <dependencies> section of your pom.xml file. This example uses version 0.6.120. Other versions are available in Aliyun Log Java SDK in Maven Repository.
<dependency> <groupId>com.aliyun.openservices</groupId> <artifactId>aliyun-log</artifactId> <version>0.6.120</version> </dependency>Always use the latest SDK version. Check the MVNRepository for updates.
-
Method 2: Import the JAR package into your Eclipse project
To import version 0.6.120:
-
In Eclipse, select your project, and then choose .
-
In the Properties dialog box, click Java Build Path in the left pane.
-
On the Libraries tab, click Add External JARs.
-
Select the downloaded JAR file and click Open.
-
Click Apply and Close.
-
Method 3: Import the JAR package into your IntelliJ IDEA project
To import version 0.6.120:
-
In IntelliJ IDEA, select your project, and then choose .
-
In the Project Structure dialog box, click Modules in the left pane.
-
On the Dependencies tab, select .
-
In the Attach Files or Directories dialog box, select the downloaded JAR file and click OK.