Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Please: Getting package does not exist for "javax.ejb.*"

 
aydeniz kirmizi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could you please help me on this? I am using NetBeans 7.0, and I am getting package does not exist for "javax.ejb.*" message.
Not sure what I am missing.

I am using java 6, I have tried everything checked the class path, checked everything. But still having the same problem.

I have Installed J2EE, and tried to set the J2EE_HOME path directory. I am using Win7. I have created to path directory on "Environment Variables" setting it to "C:\Sun\AppServer"

this is where I have my j2ee.jar file. Not sure what setill missing?
Thanks
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you compiling your code from command line or Netbeans? Did you add an application server to your Netbeans project?
 
aydeniz kirmizi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. I have my JBoss Application server added to my NetBeans.

I am not trying to run it from the command line, I am receiving the error message in Netbeans, and this is before I compile my file. a pop-up error message is displayed and
the line "import javax.ejb.*" is red-marked.

thanks
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you have the java-ee-6 api (or it's implementation) in your classpath?
 
aydeniz kirmizi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CLASSPATH .;C:\Program Files\Java\jdk1.6.0_15\lib

J2EE_HOME C:\Sun\AppServer

JAVA_HOME C:\Program Files\Java\jdk1.6.0_15

those are all I have defined. Not sure What I am missing here.

Thanks
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In NetBeans if you view the details of your project and then look at 'libraries' entry, do you see javax.* JAR's?

They should be derived from the application server you configured your project with.
If not, you must add at least the Java EE API to be able to use code-assistant and get rid of errors. Such API must not be included in your deployment archive, as the javax.* libraries are provided by the container.

You can use your application server JAR's or if you're using maven you can i.e. use the following dependency:



It's used only in compilation and testing phases - the target container will provide it's own implementation during runtime.

Cheers!
 
aydeniz kirmizi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thank you so much! I have fixed the problem with your help. What I did is, I right clicked on the project, I selected the libraries option and then I did include/import my J2EE.jar file. and this fixed the problem.

Thanks again
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem - glad it worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic