Xun
Xun

Reputation: 53

java.lang.NoClassDefFoundError: com/google/gson/GsonBuilder error

I'm trying to make an irc bot in java that uses the Google api to search for things. I found a tutorial that uses GSON and the program compiles just fine. When I try to actually use the bot I get the error.

My import:

import com.google.gson.*; 

The line that is giving me the error

Gson gson=new GsonBuilder().create(); 

I am using this as a guide http://preciselyconcise.com/apis_and_installations/json_to_java.php

Upvotes: 3

Views: 7519

Answers (1)

Alexandre Santos
Alexandre Santos

Reputation: 8338

You probably didn't do step 2 properly.

Include the gson library to your classpath.(Using an IDE you can add the gson.jar to your java project.)

If you are using an IDE, such as Eclipse and this project is a Java project (as opposed to a Maven project) then add the gson.jar to your lib folder.

Upvotes: 1

Related Questions