I am using Gson library to convert objects to Json and vice versa. I have copied the jars of that library into a new folder lib and added it to the build path for the project in my Eclipse IDE. 
I have one main class where I convert an object into Json using toJson() shown below and send it to a servlet using Apache HttpClient's HttpPost(). 
Gson gson= new Gson();
String json = gson.toJson(names);
But in the servlet I am not able to convert the Json into Object using fromJson() when I execute the following code.
Gson gson = new Gson();
Names names = gson.fromJson(s, Names.class);
It is throwing the following exception:
java.lang.NoClassDefFoundError: com/google/gson/Gson
Any idea why that could be happening? Should I have copied the jars into the WebContent/WEB-INF/lib folder instead of a new folder called lib?