title: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/cloud/bigquery/BigQueryOptions
body: <p>I'm starting to work with GCP, and I wanted to make a test just to see how to get data from a dataset in BigQuery through Eclipse. I used an existing post in which this was very well explained, but when following the steps and after creating my maven project, I got this error message:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/google/cloud/bigquery/BigQueryOptions
      at com.test_Emergya01.getData_FromBQ.getData.main(getData.java:15)
  Caused by: java.lang.ClassNotFoundException: com.google.cloud.bigquery.BigQueryOptions
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 1 more
  </code></pre>
  
  <p>This is the code I'm using right now:</p>
  
  <pre><code>import com.google.cloud.bigquery.BigQuery;
  import com.google.cloud.bigquery.BigQueryOptions;
  import com.google.cloud.bigquery.Dataset;
  import com.google.cloud.bigquery.DatasetInfo;
  
  
  public class getData 
  {
      public static void main( String[] args )
      {
  
          // Instantiates a client
          BigQuery bigquery = BigQueryOptions.getDefaultInstance().toBuilder()
                  .setProjectId("mysite-ga-datastreaming-196008").build().getService();
  
          String datasetName = "GA_data";
  
          Dataset dataset = bigquery.getDataset(datasetName);
  
          System.out.printf("Dataset %s fetched.%n", dataset.getDatasetId().getDataset());
      }
  }
  </code></pre>
  
  <p>And this is the content of my POM file:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.test-01&lt;/groupId&gt;
    &lt;artifactId&gt;getData_FromBQ&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;getData_FromBQ&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.12&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;com.google.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;google-cloud-bigquery&lt;/artifactId&gt;
        &lt;version&gt;1.25.0&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;com.test_01.getData_FromBQ.getData&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Does anyone knows what I'm doing wrong? Any help would be really appreciated.</p>