package org.codehaus.jettison.json does not exist

1.7k Views Asked by At

In my service I want to use JSONObject class to create a JSON object. For that I imported the package org.codehaus.jettison.json and saved it, but when I run the project I get this error:

error: package org.codehaus.jettison.json does not exist
[javac] import org.codehaus.jettison.json.JSONException;*

Here is my code

@POST
    @Path("/RSJson")
    @Consumes({ MediaType.APPLICATION_JSON })
    @Produces(MediaType.APPLICATION_JSON)
    public Response RSJson(JSONObject jsonobj) {
        System.out.println("Insert "+jsonobj);
        return  Response.status(Status.OK.getStatusCode()).entity(jsonobj)
                .build();
    }
1

There are 1 best solutions below

1
Santhosh Urumese On

You might have missed to add the jar to class path. Could you please make sure that the jar is added in the classpath. [ say run using java -classpath ... ]