Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The import javax.ws cannot be resolved on Eclipse

I am developing a RESTful's Webservice on java using Eclipse with the next steps:

File>New>Dynamic Web Project

Then I configured these options:

Target runtime: Apache Tomcat v7.0;

Dynamic web module version: 2.5 (because I am using Axis2);

Configuration: Default Configuration for Apache Tomcat v7.0 and (both options)

In label "Modify" I added "Axis2 Web Services" and "JAX-RS (REST Web Services)"

Next, when I created my new class, I added

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

but Eclipse launches the notice

The import javax.ws cannot be resolved

I don't know the next question

  • Is it necessary to add all the files .jar to the path WebContent/WEB-INF/lib ?
  • Or you can create, for example, a new path WebContent/WEB-INF/lib-RESTproyect?
  • If I choose the second option, will I have a problem in the future with my project?
like image 328
Jose Maria Avatar asked Jul 23 '15 12:07

Jose Maria


2 Answers

Import the jar file: javax.ws.rs-api-2.0.jar And add it to java build path. The issue will be resolved in windows.

like image 199
sumeet kumar Avatar answered Nov 15 '22 00:11

sumeet kumar


Import the jar file: javax.ws.rs-api-2.0.jar And add it to java build path. The issue will be resolved in windows.

Link to the jar : http://www.java2s.com/Code/Jar/j/Downloadjavaxwsrsapi20jar.htm

Information on importing it to Eclipse : http://tech.amikelive.com/node-269/eclipse-quick-tip-resolving-error-the-import-javaxservlet-cannot-be-resolved/comment-page-1/

like image 34
MonsieurBeilto Avatar answered Nov 15 '22 02:11

MonsieurBeilto