BigQuery: How to load library into java code

前端 未结 3 1500
一整个雨季
一整个雨季 2021-01-24 02:08

I am a new dev in Bigquery. I am following tutorial in https://developers.google.com/bigquery/bigquery-api-quickstart with Java code and imported library from https://developers

相关标签:
3条回答
  • 2021-01-24 02:22

    You need to add the necessary .jar files (separated by :) to your classpath, i.e.

    javac -cp path/to/jar1:path/to/jar2 <your_class.java>
    
    java -cp path/to/jar1:path/to/jar2 <your_class>
    

    alternatively you can add the .jar files to the CLASSPATH environment variable, i.e. (in unix systems)

    export CLASSPATH=$CLASSPATH:/path/to/some.jar:/path/to/some/other.jar
    

    This can change depending on your environment (i.e. if you are running these in a webapp server)

    0 讨论(0)
  • 2021-01-24 02:23

    Are you using Maven and the BigQuery Java Client? It is recommended to use the Java client. If so, you can easily set it up by configuring your pom.xml file:

    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-bigquery</artifactId>
      <version>1.111.1</version>
    </dependency>
    

    More info on the BigQuery Java client: https://github.com/googleapis/java-bigquery

    0 讨论(0)
  • 2021-01-24 02:24

    if you are using maven this is done easily with the following 2 dependence (you can changes the version to the latest one)

        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-storage</artifactId>
            <version>v1-rev12-1.19.0</version>
        </dependency>
    
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-bigquery</artifactId>
            <version>v2-rev168-1.19.0</version>
        </dependency> 
    
    0 讨论(0)
提交回复
热议问题