7

Using EClipse, First: I created a Dynamic Web Project and copied soem JAR files ( Jersey Jar files ) to WebContent\WEB-INF\lib folder of that project.

enter image description here

Then I created a new class and on top of it I used some imports such as these:

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

but it shows some red X errors next to all of them saying the import cannot be resolved.

That's ALL I have done. Is there any other settings I should do to fix these errors?

Bohn
  • 26,091
  • 61
  • 167
  • 254
  • Good to see that you solved your problem : [Error 404](http://stackoverflow.com/questions/11671618/getting-a-404-error-to-run-a-jersey-rest/11673316#11673316) – Ali Jul 26 '12 at 22:10

2 Answers2

55

Additional information for Jersey newbies: Those imports come from javax.ws.rs-api-2.0.jar, which is found in the "api" directory in the Jersey download, not in the "lib" directory with the jersey-*.jar jars.

pisomojado
  • 893
  • 1
  • 10
  • 11
16

First, make sure you ran "refresh" on the project. If that doesn't pick up the JARs then navigate to them in Eclipse's Project Explorer, right-click on them and in the popup menu use "Build Path" > "Add to Build Path".

Robert
  • 2,441
  • 21
  • 12