title: Upload file to Cloud Storage for Firebase with Java
body: <p>I want to add files to my Google Cloud Storage (actually a Firebase bucket) using a java server.</p>
  <p>I am using this code i got on the internet:</p>
  <pre><code>    // Authenticate using a service account
      Storage storage;
      try {
          storage = StorageOptions.newBuilder()
                  .setCredentials(ServiceAccountCredentials.fromStream(new FileInputStream(&quot;C:/tmp/firebasekey.json&quot;)))
                  .build()
                  .getService();
          // The name for the new bucket
          String bucketName = &quot;MinhaSaude&quot;;
  
          // Creates the new bucket
          Bucket bucket = storage.create(BucketInfo.of(bucketName));
          // Create blob
          BlobId blobId = BlobId.of(&quot;bucket&quot;, &quot;blob_name&quot;);
          // Add metadata to the blob
          BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType(&quot;text/plain&quot;).build();
          // Upload blob to GCS (same as Firebase Storage)
          Blob blob = storage.create(blobInfo, &quot;Hello, Cloud Storage!&quot;.getBytes());
  
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  <p>What I receive back is erros after <code>Bucket bucket = storage.create(BucketInfo.of(bucketName));</code></p>
  <p>Either &quot;Invalid bucket name: 'MinhaSaude'&quot;
  }</p>
  <p>or &quot;The account for bucket &quot;minhasaude-api&quot; has been disabled.&quot;</p>
  <p>I cant find a bucketname that satisfies google. I already uploaded a file to Firebase using browser and its uploading ok.</p>