Search code examples
javaejb

java EJB: The import javax.ejb cannot be resolved


I am reading the book Getting Started with WebSphere Application Server Community Edition.

I created an EJB project with Eclipse EE.

import javax.ejb.Local;

Error: The import javax.ejb cannot be resolved

I don't know why I cannot import this class.

Thanks


Solution

  • Probably the comments under the question already answered this, but just in case clarification is needed:

    1) In Eclipse, right click on the project --> properties --> java build path

    2) Click on add external JAR

    3) Add c:\glassfish4\glassfish\lib\javaee.jar (Your directory path to this JAR can of course be different.)

    --> Ok the dialog, and now Eclipse should be able to see javax.ejb.* classes.