Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

javax.ejb not found

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
I have attempted to write my first EJB piece, but i am stuck in the compilation itself.
I D/Led J2EE SDK 1.3.1 and JDK 1.3.1_08 on my machines.
I am able to bring up the server (j2ee) and shut it down peoperly using (j2ee -stop)
I have entered both the folders in my class CLASSPATH and PATH. JAVA_HOME and J2EE_HOME are set properly.
Still i am getting the same error.


D:\JavaCertification\SCBCDCertification\projects\advise\src\headfirst\AdviseBean.java:3: package javax.ejb does not exist
import javax.ejb.*;
^


Do i need to do setup any thing else? please advise
Thanks in advance
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should have the jars in your classpath, having folders does not help.
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try putting j2ee.jar in your classpath and that should do it. It worked for me.
 
Sekhar Kadiyala
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys, it works!!!
So to clarify my confusion on the concept, if we want to make use any classes within a JAR, then we need to include the jar also in the class path? Is this statement correct?
 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's correct!!
 
Sekhar Kadiyala
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then i have one more question. Even the regular packages are also part of JAR files only. Then why they don't have any issues?
I mean i don't mention the name of src.jar in the CLASSPATH. Then how come they are working?
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is special I think beginning with Java 1.1, or maybe Java 1.2, you no longer have to include a classpath for Java's own stuff. In other words, the compiler and the JVM that ship with J2SE SDK always KNOW how to find their own classes/jars, as long as you don't move things around within the installation directory for your J2SE install.
But you get ONLY the J2SE stuff "for free" (kind of like not having to do an explicit import of things from java.lang). ALL other classes/jars must be *somehow* on the classpath if your code needs to use them. So you can either do this permanently or semi-permanently through an environment variable or with a command-line -classpath or -cp setting when you run the compiler or the JVM.
cheers,
Kathy
 
Sekhar Kadiyala
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kathy,
Thank you for the prompt response. Now I am clear about these details.
BTW, I have half way done with the architectural view of Head First EJB.
Let me tell you, this is the best ever architecture explanation chapter that I have read. I never thought understanding architecture is so easy!
Thanks for sharing your knowledge (though it costs us a little!!!)
reply
    Bookmark Topic Watch Topic
  • New Topic