Google Cloud Storage Service features a REST-based API that allows developers to store and access arbitrarily-large objects. These sample Java applications demonstrate how to access the Google Cloud Storage JSON API using the Google Java API Client Libraries. For more information, read the Google Cloud Storage JSON API Overview.
-
Install the Google Cloud SDK, including the gcloud tool.
-
Setup the gcloud tool.
gcloud init
-
Clone this repo.
git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
-
Install Maven.
-
Build this project from this directory:
mvn package
-
Run one of the sample apps by specifying its class name and a bucket name:
mvn exec:java -Dexec.mainClass=StorageSample \ -Dexec.args="ABucketName"
Note that if it's been a while, you may need to login with gcloud.
gcloud auth application-default login