<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>0.2.2</version>
</dependency>compileDependencies {
compile 'io.minio:minio:0.2.2'
}You can download the latest jars directly from maven -
package hello.listbuckets;
import io.minio.MinioClient;
import io.minio.errors.ClientException;
import io.minio.messages.ListAllMyBucketsResult;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
public class HelloListBuckets {
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
// Set s3 endpoint, region is calculated automatically
Client s3client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
// list buckets
Iterator<Bucket> bucketList = s3Client.listBuckets();
while (bucketList.hasNext()) {
Bucket bucket = bucketList.next();
System.out.println(bucket.getName());
}
}
}- ListBuckets.java
- ListObjects.java
- BucketExists.java
- MakeBucket.java
- SetBucketAcl.java
- GetBucketAcl.java
- RemoveBucket.java
$ git clone https://github.com/minio/minio-javaEdit any examples you want to test and fill in access key placeholders
$ editor src/main/io/minio/examples/ListBuckets.java$ ./gradlew copyLibraries
$ java -cp 'lib/*' io.minio.examples.ListBuckets
bucket1
bucket2
....
...
bucketN