I am trying to upload an Image to Google Cloud storage but while creating StorageOptions I am getting project must be specified. exception.
I followed the official documentation and choose to use Json credentials after performing following steps:
- Create a new
Service Account Key - In
RoleI have selectedOwner(change it later) Download the
Jsonkey and using following sample to connect with itpublic static void main(String[] args) throws IOException { Storage storage = StorageOptions.newBuilder() .setCredentials(ServiceAccountCredentials.fromStream(new FileInputStream("/Users/test/sample/app/project-936c0c6ef960.json"))) .build() .getService(); String bucketName = "Sample"; Bucket bucket = storage.create(BucketInfo.of(bucketName)); System.out.printf("Bucket %s created.%n", bucket.getName()); }What am I doing wrong here?