Why my import is not recognized

Using EClipse, firstly: I created a dynamic web project and copied the JAR files (Jar Jar files) into the WebContent \ WEB-INF \ lib folder of this project.

enter image description here

Then I created a new class and, in addition, used some import data, such as:

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 that import cannot be allowed.

This is ALL I have done. Are there any other settings I have to make to fix these errors?

+7
source share
3 answers

First, make sure that you run the β€œupdate” project. If this does not pick up the JARs, go to them in Eclipse Project Explorer, right-click on them, and in the pop-up menu use "Build Path"> "Add to Build Path".

+16
source

Additional information for newcomers to Jersey: These imports come from javax.ws.rs-api-2.0.jar, which is located in the api directory in Jersey, and not in the lib directory with jersey- * .jar jars.

+55
source

Does this link help? It has a few different things that you can try to get Eclipse to find your files.

+2
source

All Articles