Adding external jars to eclipse GWT projects

113 views
Skip to first unread message

Taher Abouzeid

unread,
Dec 25, 2014, 6:09:10 PM12/25/14
to google-we...@googlegroups.com
I want to use the gson jar to encode and decode data in json. i put it in the war/WEB-INF/lib directory and used it in the code but eclipse couldn't find it in order to be able to work with it until i added it to the build path for the project. but after i do the gwt compile and start the server and send a request, i get the following error

WARNING: Error for /functionlibrary/functionlibrary

java.lang.Error: Unresolved compilation problems: 

Gson cannot be resolved to a type

GsonBuilder cannot be resolved to a type


i have searched online in countless forum posts and none of them work... i'm using gson jar exclusively on the server side, and when i try to use the one in the repackaged package that comes with gwt i get an error saying that it's unreliable. i'd like someone to give me precise instructions on how to add any jar i like to the server side code to work with.

Thad Humphries

unread,
Dec 29, 2014, 4:58:03 PM12/29/14
to google-we...@googlegroups.com
Are you trying to use Gson in client-side code? That will not work. (see http://www.gwtproject.org/doc/latest/DevGuideCodingBasics.html)

GWT includes the package com.google.gwt.json.client for client-side JSON. You can use Gson or another JSON package on the server-side (I use json.org).
Reply all
Reply to author
Forward
0 new messages