Sophie Sepp
Sophie Sepp

Reputation: 551

java.lang.NoClassDefFoundError: com/google/gwt/json/client/JSONParser at runtime when trying to parse json

I'm working with GWT and I'm getting a java.lang.NoClassDefFoundError: com/google/gwt/json/client/JSONParser Exception at runtime when I try to parse JSON.

I've imported the following: import com.google.gwt.json.client.JSONParser;

My code is

String r = ((Text) Entity.getProperty("result")).getValue();    
JSONValue jsonValue;
jsonValue = JSONParser.parseStrict(r);

Generally I would say that the jar couldn't be found, but in that case no external jar is needed, right? So what is wrong here and how can I fix it?

Upvotes: 2

Views: 2169

Answers (1)

Andrea Boscolo
Andrea Boscolo

Reputation: 3048

To work with JSON, you need to inherit the right module (in your application module).

<inherits name='com.google.gwt.json.JSON'/>

Also, be sure to have gwt-user.jar in your classpath.

Upvotes: 1

Related Questions