0

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();
    }
Abra
  • 19,142
  • 7
  • 29
  • 41
Shini
  • 51
  • 7
  • 2
    Possible duplicate of [javac error: “package x does not exist” at “import x”](https://stackoverflow.com/questions/12718723/javac-error-package-x-does-not-exist-at-import-x/12718762). – LHCHIN Jan 03 '20 at 05:28

1 Answers1

0

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 ... ]

  • 1
    According to the error details, there is a compiler error which means the OP can't run his code since it doesn't compile, so I don't think advice regarding the _java_ command will help solve the problem. – Abra Jan 03 '20 at 06:00