aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Help Please: Getting package does not exist for Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Help Please: Getting package does not exist for "javax.ejb.*"" Watch "Help Please: Getting package does not exist for "javax.ejb.*"" New topic
Author

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

aydeniz kirmizi
Ranch Hand

Joined: Aug 20, 2009
Posts: 38
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

Joined: Aug 03, 2008
Posts: 9280
    
  17

Are you compiling your code from command line or Netbeans? Did you add an application server to your Netbeans project?


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
aydeniz kirmizi
Ranch Hand

Joined: Aug 20, 2009
Posts: 38
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

Joined: Jul 13, 2010
Posts: 610

Are you sure you have the java-ee-6 api (or it's implementation) in your classpath?


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
aydeniz kirmizi
Ranch Hand

Joined: Aug 20, 2009
Posts: 38
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

Joined: Jul 13, 2010
Posts: 610

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

Joined: Aug 20, 2009
Posts: 38

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

Joined: Jul 13, 2010
Posts: 610

No problem - glad it worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help Please: Getting package does not exist for "javax.ejb.*"
 
Similar Threads
Error Compiling EJBs from command prompt
Getting error while compling the First Java file
ejb compiling
Error Compiling EJBs from command prompt
Package ... not found errors with 1.4