Before you can use Simple Log Service SDK for Java to call the API operations of Simple Log Service, you must install Simple Log Service SDK for Java. This topic describes how to install Simple Log Service SDK for Java by using various methods. You can choose a method based on your business requirements.
Prerequisites
Simple Log Service is activated. For more information, see Activate Simple Log Service.
A Java development environment is installed.
Simple Log Service SDK for Java supports Java runtime environment (JRE) 6.0 or later. You can run the java -version command to check the version of your Java development environment. If no Java development environment is installed, you can download an installation package from the Java official website and install the Java development environment.
Install Simple Log Service SDK for Java
You can install Simple Log Service SDK for Java by using one of the following methods:
Method 1: Add dependencies to your Maven project. This method is recommended.
If you want to use Simple Log Service SDK for Java in Maven, you need only to add the required dependencies to the pom.xml file. After you add the dependencies, Maven automatically downloads the required Java Archive (JAR) package. In this example, the dependency version 0.6.120 is used. Add the following content to <dependencies>. For more information, see Alibaba Cloud Simple Log Service SDK for Java in Maven Repository.
<dependency> <groupId>com.aliyun.openservices</groupId> <artifactId>aliyun-log</artifactId> <version>0.6.120</version> </dependency>
The packages include the dependencies that you need to add to your Maven project when you call a Simple Log Service SDK. We recommend that you obtain the latest version of Simple Log Service SDK for Java for debugging to prevent errors.
Method 2: Import a JAR package to your Eclipse project.
In this example, the dependency version 0.6.120 is used. To import the JAR package, perform the following steps:
Select your project in Eclipse and choose
.On the left side of the Properties dialog box, click Java Build Path.
On the Libraries tab, click Add External JARs.
Select the JAR package that you downloaded and click Open.
Click Apply and Close.
Method 3: Import a JAR package to your IntelliJ IDEA project.
In this example, the dependency version 0.6.120 is used. To import the JAR package, perform the following steps:
Select your project in IntelliJ IDEA and choose
.On the left side of the Project Structure dialog box, click Modules.
On the Dependencies tab, choose
.In the Attach Files or Directories dialog box, select the JAR package that you downloaded and click OK.