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.google.com/bigquery/client-libraries . However, I couldn't load library into Java code such as import com.google.api.services.bigquery.model.DatasetList; import com.google.api.services.bigquery.model.GetQueryResultsResponse; import com.google.api.services.bigquery.model.Job
import com.google.api.services.bigquery.model.DatasetList; import com.google.api.services.bigquery.model.GetQueryResultsResponse; import com.google.api.services.bigquery.model.Job
import com.google.api.services.bigquery.model.DatasetList; import com.google.api.services.bigquery.model.GetQueryResultsResponse; import com.google.api.services.bigquery.model.Job
Please tell me know how to solve this case.
Thanks
You need to add the necessary .jar
files (separated by :
) to your classpath, ie
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, ie (in unix systems)
export CLASSPATH=$CLASSPATH:/path/to/some.jar:/path/to/some/other.jar
This can change depending on your environment (ie if you are running these in a webapp server)
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>
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.