You need to enable JavaScript to run this app.
导航

初始化

最近更新时间2023.11.14 10:47:35

首次发布时间2022.06.14 18:45:24

Java SDK 可通过 Access Key 初始化。您可以根据需求选择设置 AK/SK 的方法。本文为您介绍初始化的操作步骤。

前置条件

初始化

智能处理支持的区域:华北 cn-north-1

AK/SK 设置方法

支持 3 种 AK/SK 的设置方法。

  • 方法一:在代码中设置
impService.setAccessKey("ak");
impService.setSecretKey("sk");
  • 方法二:在环境变量中设置
VOLC_ACCESSKEY="ak"
VOLC_SECRETKEY="sk"
  • 方法三:在文件中设置

在本地的 ~/.volc/config 中添加如下内容:

{
   "ak":"Your-AK",
   "sk":"Your-SK"
}

初始化代码

package com.volcengine.example;

import com.volcengine.service.imp.IImpService;
import com.volcengine.service.imp.impl.ImpServiceImpl;

public class Demo {

    public static void main(String[] args) throws Exception {
        IImpService impService = ImpServiceImpl.getInstance();

        // call below method if you don't set ak and sk
        impService.setAccessKey("your ak");
        impService.setSecretKey("your sk");
        // then call special actions
    }
}