[TOC] # Maven Dependency ```xml <dependency> <groupId>com.aliyun.oss</groupId> <artifactId>aliyun-sdk-oss</artifactId> <version>3.8.0</version> </dependency> ``` Source: [GitHub](https://github.com/aliyun/aliyun-oss-java-sdk) # 配置访问凭证 使用 Java SDK 发起 OSS 请求,您需要配置访问凭证。 ```java // RAM 用户的访问密钥(AccessKey ID 和 AccessKey Secret)。 String accessKeyId = "yourAccessKeyId"; String accessKeySecret = "yourAccessKeySecret"; // 使用代码嵌入的 RAM 用户的访问密钥配置访问凭证。 CredentialsProvider credentialsProvider = new DefaultCredentialProvider( accessKeyId, accessKeySecret ); ``` 配置访问凭证后,您需要初始化 `OSSClient`。 Reference: - [Java 配置访问凭证](https://help.aliyun.com/document_detail/2362535.html) # 初始化 初始化 `OSSClient` 后,您可以使用 `OSSClient` 发起请求。 Reference: - [Java 初始化](https://help.aliyun.com/document_detail/32010.html) # 快速入门 Reference: - [Java 快速入门](https://help.aliyun.com/document_detail/32011.html)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up