- Documentation
File Storage vePFS
SDK Reference
Java SDK
Initialize the client
Java SDK
Initialize the client
Initialize the client
The vePFS Java client for file storage offers a range of interfaces to interact with the vePFS file storage service and manage resources. You must initialize the Java client before sending HTTP/HTTPS requests to the vePFS file storage service. This article explains how to initialize the Java client.
Prerequisites
- When initializing the client, you need the following information:
- Access Key ID (AK) and Secret Access Key (SK) for the account. For information on how to obtain AKSK, see View AKSK information.
- Region information. The Region supported by vePFS file storage. For details, see Service Address.
Configure environment variables
Hardcoding the AccessKey in your business code poses security risks. We recommend managing the AccessKey by configuring environment variables.
- Linux / macOS operating systems
- The steps for configuring environment variables are as follows:
export VOLCENGINE_ACCESS_KEY_ID=<Your AccessKey ID>
export VOLCENGINE_ACCESS_KEY_SECRET=<Your AccessKey Secret>
- Windows operating system
- The steps for configuring environment variables are as follows:
- Create a new environment variable file. Add the environment variables VOLCENGINE_ACCESS_KEY_ID and VOLCENGINE_ACCESS_KEY_SECRET, then write your AccessKey ID and AccessKey Secret.
- Restart the Windows system.
Initialize the client
Use the following code to initialize the client.
package com.volcengine.vepfs.examples;
import com.volcengine.ApiClient;
import com.volcengine.ApiException;
import com.volcengine.sign.Credentials;
import com.volcengine.vepfs.VepfsApi;
import com.volcengine.vepfs.model.*;
public static VepfsApi api;
public static void initClient() {
String ak = System.getenv("VOLCENGINE_ACCESS_KEY_ID");
String sk = System.getenv("VOLCENGINE_ACCESS_KEY_SECRET");
String region = "Your Region";
ApiClient apiClient = new ApiClient()
.setCredentials(Credentials.getCredentials(ak, sk))
api = new VepfsApi(apiClient);
Last updated: 2026.03.03 10:39:10