GWT 1.1: The import com.google.gwt.json cannot be resolved

1,040 views
Skip to first unread message

hoosie

unread,
Aug 11, 2006, 6:58:39 PM8/11/06
to Google Web Toolkit
I've been working on a project for some time that uses the previous
example JSON java files. Now that JSON has moved into the core I
removed all the files and placed the following import statements at the
beginning just as in the new JSON example:

import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONException;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;

All of these result in compiler errors in the hosted browser,
repeatedly reporting "The import com.google.gwt.json cannot be
resolved".

I am stumped - is there anything else I need to do to use these new
classes?

Thanks!

Henry

unread,
Aug 11, 2006, 9:07:00 PM8/11/06
to Google Web Toolkit
There sure is! You'll need to add
<inherits name="com.google.gwt.json.JSON/>
to your XXX.gwt.xml where XXX is the name of your app.

This is required so that we actually compile the JSON code into the
resulting Javascript. Similarly, if you want to use XML DOM support,
add
<inherits name="com.google.gwt.xml.XML"/>
to your XXX.gwt.xml

Thanks

Henry

baldmo...@gmail.com

unread,
Sep 8, 2006, 10:31:17 AM9/8/06
to Google Web Toolkit
Thanks Henry,

I ran into this too and your suggestion fixed the issue for me.


geoff

Reply all
Reply to author
Forward
0 new messages