title: How to make a java backend Firebase database connection
body: <p>I would like to use java to insert entries into my Firebase Database (java NOT in the android environment). Is this even possible? </p>
  
  <p>If it is can you please help me figure out why I'm getting this error:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NoSuchMethodError: com.google.firebase.FirebaseOptions$Builder.setCredential(Lcom/google/firebase/auth/FirebaseCredential;)Lcom/google/firebase/FirebaseOptions$Builder;</p>
  </blockquote>
  
  <p>The problem occurs at the `setCredential line below in my maven project in eclipse?</p>
  
  <pre><code>    try {
          FileInputStream serviceAccount = new FileInputStream(file);
          FirebaseOptions options = new FirebaseOptions.Builder()
                  .setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
                  .setDatabaseUrl(url)
                  .build();
          FirebaseApp.initializeApp(options);
      } catch (FileNotFoundException e) {
          System.out.println("ERROR: invalid service account credentials. See README.");
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      // Shared Database reference
      DatabaseReference database = FirebaseDatabase.getInstance().getReference();
  </code></pre>