All Products
Search
Document Center

Simple Log Service:Install Simple Log Service SDK for Java

Last Updated:Oct 26, 2023

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.

  • An AccessKey pair is created and obtained. For more information, see AccessKey pair.

    An Alibaba Cloud account has permissions to call all API operations. If you use the AccessKey pair of an Alibaba Cloud account, security risks may occur. We recommend that you create and use a RAM user to call API operations or perform routine O&M. Make sure that the RAM user is granted the permissions to perform operations on Simple Log Service resources. For more information, see Grant permissions to a RAM user.

  • 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.75 is used. Add the following content to <dependencies>:

    <dependency>
        <groupId>com.aliyun.openservices</groupId>
        <artifactId>aliyun-log</artifactId>
        <version>0.6.75</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. For more information, see Alibaba Cloud Simple Log Service SDK for Java in Maven Repository.

  • Method 2: Import a JAR package to your Eclipse project.

    In this example, the dependency version 0.6.75 is used. To import the JAR package, perform the following steps:

    1. Download the Simple Log Service SDK for Java package.

    2. Select your project in Eclipse and choose File > Properties.

    3. On the left side of the Properties dialog box, click Java Build Path.

    4. On the Libraries tab, click Add External JARs.

    5. Select the JAR package that you downloaded and click Open.

    6. Click Apply and Close.

  • Method 3: Import a JAR package to your IntelliJ IDEA project

    In this example, the dependency version 0.6.75 is used. To import the JAR package, perform the following steps:

    1. Download the Simple Log Service SDK for Java package.

    2. Select your project in IntelliJ IDEA and choose File > Project Structure.

    3. On the left side of the Project Structure dialog box, click Modules.

    4. On the Dependencies tab, choose + > JARs or directories.

    5. In the Attach Files or Directories dialog box, select the JAR package that you downloaded and click OK.

What to do next

Get started with Log Service SDK for Java