title: When connecting java to Google Big Query I get Exception in thread "main" java.lang.NoClassDefFoundError: com/google/api/client/json/JsonFactory
body: <p>I have a Java program that I want to use to run queries against google big query.</p>
  
  <p>I am getting this error when starting my program:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/google/api/client/json/JsonFactory
      at com.simba.googlebigquery.googlebigquery.core.BQConnection.connect(Unknown Source)
      at com.simba.googlebigquery.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
      at com.simba.googlebigquery.jdbc.common.AbstractDriver.connect(Unknown Source)
      at java.sql.DriverManager.getConnection(DriverManager.java:664)
      at java.sql.DriverManager.getConnection(DriverManager.java:270)
      at missioncontrol.main(missioncontrol.java:60)
  Caused by: java.lang.ClassNotFoundException: com.google.api.client.json.JsonFactory
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 6 more
  </code></pre>
  
  <p>I have downloaded the Simba gbq jdbc driver.  I have set up my authorizations.  My connection string looks like this:</p>
  
  <pre><code>jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=redacted;OAuthType=0;OAuthServiceAcctEmail=;redaacted@redacted.iam.gserviceaccount.com;OAuthPvtKeyPath=/home/redacted/redacted/redacted.p12;
  </code></pre>
  
  <p>My CLASSPATH Originally looked like this:
  /opt/google/GoogleBigQueryJDBC42.jar</p>
  
  <p>But I've added a bunch of jar files in an effort to solve this problem, so now it looks like this:</p>
  
  <pre><code>/google-http-client-1.29.0.jar:/opt/google/google-http-client-jackson2-1.28.0.jar:/opt/google/jackson-annotations-2.9.0.jar:/opt/google/jackson-core-2.9.8.jar:/opt/google/jackson-databind-2.9.8.jar:/opt/google/GoogleBigQueryJDBC42.jar
  </code></pre>
  
  <p>This is my environment:</p>
  
  <pre><code>$uname -a
  Linux ip-172-31-59-210.ec2.internal 4.14.123-111.109.amzn2.x86_64 #1 SMP Mon Jun 10 19:37:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  
  $java -version
  openjdk version "1.8.0_222-ea"
  OpenJDK Runtime Environment (build 1.8.0_222-ea-b03)
  OpenJDK 64-Bit Server VM (build 25.222-b03, mixed mode)
  </code></pre>
  
  <p>Any thoughts on what I am missing?</p>
  
  <p>Thanks,
  Mary</p>